[PATCH] USB: g_mass_storage: min(...) warning fixed

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

 



From: Michal Nazarewicz <m.nazarewicz@xxxxxxxxxxx>

This patch fixes warning caused by calling min() macro
with arguments of different types:

  drivers/usb/gadget/f_mass_storage.c:623: warning: \
  comparison of distinct pointer types lacks a cast

This fixes commit a736e2758c6390b854219e6f6bb4f9a0e3be66df.

Signed-off-by: Michal Nazarewicz <m.nazarewicz@xxxxxxxxxxx>
Cc: Marek Szyprowski <m.nazarewicz@xxxxxxxxxxx>
Cc: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
---
 drivers/usb/gadget/f_mass_storage.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Hello,

On Wed, 03 Feb 2010 06:57:26 +0100, Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:

> today's linux-next build produced these warnings:
> 
> drivers/usb/gadget/f_mass_storage.c: In function 'fsg_setup':
> drivers/usb/gadget/f_mass_storage.c:623: warning: comparison of distinct pointer types lacks a cast
> 
> Introduced by commit a736e2758c6390b854219e6f6bb4f9a0e3be66df ("USB:
> g_mass_storage: superfluous and missing packets fixed").

Sorry about that.  Attached is patch fixing that.  I've overlooked the
fact that w_length is u16 not int.

diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index b5a8902..b5cad39 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -620,7 +620,7 @@ static int fsg_setup(struct usb_function *f,
 		*(u8 *) req->buf = fsg->common->nluns - 1;
 
 		/* Respond with data/status */
-		req->length = min(1, w_length);
+		req->length = min((u16)1, w_length);
 		fsg->common->ep0req_name =
 			ctrl->bRequestType & USB_DIR_IN ? "ep0-in" : "ep0-out";
 		return ep0_queue(fsg->common);
-- 
1.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-next" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux