From: Larry Finger <larry.finger@xxxxxxxxx> on behalf of Larry Finger <Larry.Finger@xxxxxxxxxxxx> Sent: Thursday, April 30, 2015 11:03 PM To: Gujulan Elango, Hari Prasath (H.); Dan Carpenter Cc: devel@xxxxxxxxxxxxxxxxxxxx; Julia.Lawall@xxxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx; wlanfae@xxxxxxxxxxx; mateusz.kulikowski@xxxxxxxxx; Babu, Viswanathan (V.) Subject: Re: [PATCH] staging: rtl8192e: fix wrong assignment On 04/30/2015 11:59 AM, Gujulan Elango, Hari Prasath (H.) wrote: > From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> > Sent: Thursday, April 30, 2015 6:33 PM > To: Gujulan Elango, Hari Prasath (H.) > Cc: devel@xxxxxxxxxxxxxxxxxxxx; Julia.Lawall@xxxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx; wlanfae@xxxxxxxxxxx; mateusz.kulikowski@xxxxxxxxx; Babu, Viswanathan (V.); Larry.Finger@xxxxxxxxxxxx > Subject: Re: [PATCH] staging: rtl8192e: fix wrong assignment > > On Thu, Apr 30, 2015 at 12:06:28PM +0000, Gujulan Elango, Hari Prasath (H.) wrote: >> This patch addresses a spatch warning on assigning a negative >> value to a unsigned integer.Similar patch has been submitted by >> Larry Finger earlier to silence the same spatch warning in another >> file. > > What's the git hash and title for Larry's patch? > >> The logic is the negative number to an unsigned quantity is >> fixed by adding 256 to -98 to get the equivalent negative number as >> per Larry Finger. > >>> It was a spatch warning.I am not sure if that change by Larry went in,but here's the link where I found a submission by Larry. > http://permalink.gmane.org/gmane.linux.kernel.wireless.general/113125 If you actually read that patch, you will see that the "fix" was to remove the noise member initialization. The git hash, title, and commit message for the previous change was as follows: commit 354d0f3c40fb40193213e40f3177ff528798ca8d Author: Larry Finger <Larry.Finger@xxxxxxxxxxxx> Date: Wed Sep 25 12:57:47 2013 -0500 rtlwifi: Fix smatch warnings in usb.c Smatch displays the following: CHECK drivers/net/wireless/rtlwifi/usb.c drivers/net/wireless/rtlwifi/usb.c:458 _rtl_usb_rx_process_agg() warn: assigning (-98) to unsigned variable 'stats.noise' drivers/net/wireless/rtlwifi/usb.c:503 _rtl_usb_rx_process_noagg() warn: assigning (-98) to unsigned variable 'stats.noise' drivers/net/wireless/rtlwifi/usb.c:596 _rtl_rx_get_padding() info: ignoring unreachable code. drivers/net/wireless/rtlwifi/usb.c:596 _rtl_rx_get_padding() info: ignoring unreachable code. The variable 'stats.noise' is not used, thus the initializers are removed. The unreachable code info is fixed by including the appropriate section inside #ifdef .. #endif constructions. Signed-off-by: Larry Finger <Larry.Finger@xxxxxxxxxxxx> Signed-off-by: John W. Linville <linville@xxxxxxxxxxxxx> If you are going to be submitting kernel patches, then I suggest a tutorial on the usage of git so that you can find previous commits. Unlike the rtlwifi drivers, this one appears to set the noise value, thus a simple removal of the initialization is not appropriate. Your fix of setting the value to 256-98 seems to be correct. >>> I did see the git log related to this file. I was not sure if I could remove the variable right away assuming the variable is used somewhere. Hence I sticked with just silencing the smatch warning. _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel