[PATCH] i2c: add Atmel AT91 driver

Raphaël Poggi raphio98 at gmail.com
Thu Jul 24 04:12:04 PDT 2014


Hi Sascha,

Thanks for your review, I'll correct these and send a v2.

Raphaël

2014-07-24 11:34 GMT+02:00 Sascha Hauer <s.hauer at pengutronix.de>:
> 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 at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox



More information about the barebox mailing list