Re: [PATCH 1/3] staging: ft1000: Fix compilation warning.

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

 



Hi Randy,

On Wed, Nov 10, 2010 at 5:38 PM, Randy Dunlap <rdunlap@xxxxxxxxxxxx> wrote:
> On Wed, 10 Nov 2010 11:15:26 +0100 Marek Belisko wrote:
>
>> Signed-off-by: Marek Belisko <marek.belisko@xxxxxxxxx>
>> ---
>> Âdrivers/staging/ft1000/ft1000-usb/ft1000_usb.c | Â Â2 +-
>> Â1 files changed, 1 insertions(+), 1 deletions(-)
>
>
> a. Âalways include the warning or error message that the patch fixes
>
> b. Â(quoting from another email yesterday:)
>
> so in your analysis of this compiler warning, was the warning correct & justified,
> or was it false? ÂI.e., is the init to NULL needed?
After code analysis NULL assignment is necessary. Function have
multiple goto statements
and pointer is assigned after some goto are placed. In one of
statements at the end of function
there is kthread stopping which use pft1000info pointer (this part
isn't applicable if pft1000info isn't initialized).
Hopefully this is what compiler complain about (could return with some
goto statement but pft1000info isn't initialized but
used). This warning was introduced when make common return point for
some error states.
>
> If it was false, could we just silence the warning by using:
>
> Â Â Â Âstruct ft1000_info *unitialized_var(pft1000info);
>
> plus #include <linux/compiler.h> ?
>
>
>> diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
>> index 99e3339..b7c4602 100644
>> --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
>> +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
>> @@ -64,7 +64,7 @@ static int ft1000_probe(struct usb_interface *interface,
>> Â Â Â int i, ret = 0, size;
>>
>> Â Â Â struct ft1000_device *ft1000dev;
>> - Â Â struct ft1000_info *pft1000info;
>> + Â Â struct ft1000_info *pft1000info = NULL;
>> Â Â Â const struct firmware *dsp_fw;
>>
>> Â Â Â ft1000dev = kmalloc(sizeof(struct ft1000_device), GFP_KERNEL);
>> --
>
>
> ---
> ~Randy
> *** Remember to use Documentation/SubmitChecklist when testing your code ***
>

thanks,

marek

-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux