lkml.org 
[lkml]   [2010]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/3] staging: ft1000: Fix compilation warning.
    On Fri, 12 Nov 2010 10:57:19 +0100 Belisko Marek wrote:

    > Hi Randy,
    >
    > On Wed, Nov 10, 2010 at 5:38 PM, Randy Dunlap <rdunlap@xenotime.net> wrote:
    > > On Wed, 10 Nov 2010 11:15:26 +0100 Marek Belisko wrote:
    > >
    > >> Signed-off-by: Marek Belisko <marek.belisko@gmail.com>
    > >> ---
    > >>  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.

    Thanks for checking and reporting on that.

    Sorry, but I disagree. Greg can do whatever he wants to do with the patch.


    > > 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);
    > >> --
    > >
    > >
    > > ---
    >
    > thanks,
    >
    > marek


    ---
    ~Randy
    *** Remember to use Documentation/SubmitChecklist when testing your code ***
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2010-11-12 17:31    [W:0.023 / U:60.096 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site