[U-Boot] [PATCH 2/3] drivers/gpio/pm8916_gpio.c: Make pid be uint32_t

Tom Rini trini at konsulko.com
Wed Apr 20 23:25:41 CEST 2016


On Mon, Apr 18, 2016 at 10:23:24PM +0200, Mateusz Kulikowski wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Hi,
> 
> Sorry for slow reply.
> 
> On 12.04.2016 21:11, Tom Rini wrote:
> > If get_dev_addr fails it will return FDT_ADDR_T_NONE and:
> >>>>     "priv->pid == 4294967295U" is always false regardless of the values of its operands. This occurs as the logical operand of if.
> > 
> > Cc: Mateusz Kulikowski <mateusz.kulikowski at gmail.com>
> > Reported-by: Coverity (CID: 143913)
> [...]
> 
> > -	uint16_t pid; /* Peripheral ID on SPMI bus */
> > +	uint32_t pid; /* Peripheral ID on SPMI bus */
> >  };
> >  
> >  static int pm8916_gpio_set_direction(struct udevice *dev, unsigned offset,
> > 
> 
> Note applies to two patches in this series (pm8916_gpio.c and pm8916.c)
> 
> I think (now, when the coverity pointed out mistake) that we should add
> in that case check if pid fits in 16-bits, as this is maximum pid value on spmi bus.
> 
> This checks should be done in pm8916_gpio_probe() and pm8916_probe().
> 
> Would you like to do it in your series or want me to post another patch on top of them?

Please do a follow up, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160420/ba042fa9/attachment.sig>


More information about the U-Boot mailing list