[U-Boot] [EXT] Re: [PATCH 2/4] armv8: ls2088aqds: The ls2088aqds board supports the I2C driver model.
Chuanhua Han
chuanhua.han at nxp.com
Wed Jul 24 11:36:31 UTC 2019
> -----Original Message-----
> From: Wolfgang Denk <wd at denx.de>
> Sent: 2019年7月24日 14:55
> To: Chuanhua Han <chuanhua.han at nxp.com>
> Cc: albert.u.boot at aribaud.net; Prabhakar Kushwaha
> <prabhakar.kushwaha at nxp.com>; Priyanka Jain <priyanka.jain at nxp.com>;
> Rajesh Bhagat <rajesh.bhagat at nxp.com>; u-boot at lists.denx.de;
> lukma at denx.de; trini at konsulko.com
> Subject: [EXT] Re: [PATCH 2/4] armv8: ls2088aqds: The ls2088aqds board
> supports the I2C driver model.
>
> Caution: EXT Email
>
> Dear Chuanhua,
>
> In message <20190724025904.469-2-chuanhua.han at nxp.com> you wrote:
> > This patch is updating ls2088aqds board init code to support DM_I2C.
>
> I have a generic question about error handling in your code:
>
> > + a = 0x18;
> > + dm_i2c_write(udev, 6, &a, 1);
> > + a = 0x38;
> > + dm_i2c_write(udev, 4, &a, 1);
> > + a = 0x4;
> > + dm_i2c_write(udev, 8, &a, 1);
> > +
> > + dm_i2c_write(udev, 0xf, &ch_a_eq[i], 1);
> > + dm_i2c_write(udev, 0x11, &ch_a_ctl2[j],
> > + 1);
> > +
> > + dm_i2c_write(udev, 0x16, &ch_b_eq[i],
> 1);
> > + dm_i2c_write(udev, 0x18, &ch_b_ctl2[j],
> > + 1);
> > +
> > + a = 0x14;
> > + dm_i2c_write(udev, 0x23, &a, 1);
> > + a = 0xb5;
> > + dm_i2c_write(udev, 0x2d, &a, 1);
> > + a = 0x20;
> > + dm_i2c_write(udev, 4, &a, 1);
> ...
> > i2c_write(0x77, 0, 0, &a, 1);
> ...
>
> You use a large number of functions without ever checking their return codes.
> But all these functions can fail for a number of reasons. Should you not always
> check for errors?
yes,should to check for errors!
>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de He
> had quite a powerful intellect, but it was as powerful like a locomotive,
> and ran on rails and was therefore almost impossible to
> steer. - Terry Pratchett, _Lords and Ladies_
More information about the U-Boot
mailing list