mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Raphaël Poggi" <poggi.raph@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] i2c: add Atmel AT91 driver
Date: Thu, 24 Jul 2014 11:34:36 +0200	[thread overview]
Message-ID: <20140724093436.GJ23235@pengutronix.de> (raw)
In-Reply-To: <1406142544-10516-1-git-send-email-poggi.raph@gmail.com>

Hi Raphaël,

Looks mostly fine to me. Two small comments:

On Wed, Jul 23, 2014 at 12:09:04PM -0700, Raphaël Poggi wrote:
> +
> +static int at91_twi_probe(struct device_d *dev)
> +{
> +	struct at91_twi_dev *i2c_at91;
> +	struct at91_twi_pdata *i2c_data;
> +	int rc;
> +	u32 bus_clk_rate;
> +
> +	i2c_at91 = kzalloc(sizeof(struct at91_twi_dev), GFP_KERNEL);
> +	if (!i2c_at91) {
> +	    rc = -ENOMEM;
> +	    goto out_free;
> +	}

You can safely use xzalloc here and skip the result check.

> +
> +	rc = dev_get_drvdata(dev, (unsigned long *)&i2c_data);
> +	if (rc)
> +		goto out_free;
> +
> +	i2c_at91->pdata = i2c_data;
> +
> +	i2c_at91->base = dev_request_mem_region(dev, 0);
> +	if (IS_ERR(i2c_at91->base))
> +		return PTR_ERR(i2c_at91->base);

dev_request_mem_region returns NULL on error, not an error pointer.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2014-07-24  9:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 19:09 Raphaël Poggi
2014-07-24  9:34 ` Sascha Hauer [this message]
2014-07-24 11:12   ` Raphaël Poggi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140724093436.GJ23235@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=poggi.raph@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox