Re: [patch 2/2 v2] leds: netxbig: silence a static checker warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 10, 2015 at 04:18:34PM +0200, Jacek Anaszewski wrote:
> Hi Dan,
> 
> On 04/10/2015 10:30 AM, Dan Carpenter wrote:
> >Static checkers complain that "timers[i].delay_on" is an unsigned long
> >but we're writing to only 32 bits of it.  The code works on 32 bit
> >systems and little endian 64 bit systems so it doesn't cause a problem
> >in practise but it's still better to silence the warning.
> >
> >Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> >---
> >v2: use a temporary variable
> >
> >diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c
> >index 028686f2..6cb4537 100644
> >--- a/drivers/leds/leds-netxbig.c
> >+++ b/drivers/leds/leds-netxbig.c
> >@@ -444,12 +444,17 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
> >  		if (!timers)
> >  			return -ENOMEM;
> >  		for (i = 0; i < num_timers; i++) {
> >+			u32 delay_on = 0;
> >+			u32 delay_off = 0;
> 
> These variables don't need initialization, as they are assigned
> a new value in of_property_read_u32_index anyway.

I don't know this hardware and I can't even test it so I didn't feel
comfortable leaving it out.  Also static checkers will complain that
we are ignoring the error paths.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux