Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: FHCI: cq_get() should check kfifo_out()'s return value

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>
Cc: stable <stable@kernel.org> [.33 and .34]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Anton Vorontsov and committed by
Greg Kroah-Hartman
7f1cccd3 12e7eca9

+7 -2
+7 -2
drivers/usb/host/fhci.h
··· 20 20 21 21 #include <linux/kernel.h> 22 22 #include <linux/types.h> 23 + #include <linux/bug.h> 23 24 #include <linux/spinlock.h> 24 25 #include <linux/interrupt.h> 25 26 #include <linux/kfifo.h> ··· 516 515 517 516 static inline void *cq_get(struct kfifo *kfifo) 518 517 { 519 - void *p = NULL; 518 + unsigned int sz; 519 + void *p; 520 520 521 - kfifo_out(kfifo, (void *)&p, sizeof(p)); 521 + sz = kfifo_out(kfifo, (void *)&p, sizeof(p)); 522 + if (sz != sizeof(p)) 523 + return NULL; 524 + 522 525 return p; 523 526 } 524 527