lkml.org 
[lkml]   [2010]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[048/200] USB: FHCI: cq_get() should check kfifo_out()s return value
    2.6.34-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Anton Vorontsov <avorontsov@mvista.com>

    commit 7f1cccd3ec8789e52897bc34420ca81a5e2edeab upstream.

    Since commit 7acd72eb85f1c7a15e8b5eb554994949241737f1 ("kfifo: rename
    kfifo_put... into kfifo_in... and kfifo_get... into kfifo_out..."),
    kfifo_out() is marked __must_check, and that causes gcc to produce
    lots of warnings like this:

    CC drivers/usb/host/fhci-mem.o
    In file included from drivers/usb/host/fhci-hcd.c:34:
    drivers/usb/host/fhci.h: In function 'cq_get':
    drivers/usb/host/fhci.h:520: warning: ignoring return value of 'kfifo_out', declared with attribute warn_unused_result
    ...

    This patch fixes the issue by properly checking the return value.

    Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

    ---
    drivers/usb/host/fhci.h | 9 +++++++--
    1 file changed, 7 insertions(+), 2 deletions(-)

    --- a/drivers/usb/host/fhci.h
    +++ b/drivers/usb/host/fhci.h
    @@ -20,6 +20,7 @@

    #include <linux/kernel.h>
    #include <linux/types.h>
    +#include <linux/bug.h>
    #include <linux/spinlock.h>
    #include <linux/interrupt.h>
    #include <linux/kfifo.h>
    @@ -515,9 +516,13 @@ static inline int cq_put(struct kfifo *k

    static inline void *cq_get(struct kfifo *kfifo)
    {
    - void *p = NULL;
    + unsigned int sz;
    + void *p;
    +
    + sz = kfifo_out(kfifo, (void *)&p, sizeof(p));
    + if (sz != sizeof(p))
    + return NULL;

    - kfifo_out(kfifo, (void *)&p, sizeof(p));
    return p;
    }




    \
     
     \ /
      Last update: 2010-07-01 23:59    [W:4.147 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site