USB: storage: fix compile warning
authorMing Lei <ming.lei@canonical.com>
Tue, 10 Dec 2013 07:01:42 +0000 (15:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Dec 2013 07:45:39 +0000 (23:45 -0800)
This patch should fix the below compile warning:

drivers/usb/storage/protocol.c: In function 'usb_stor_access_xfer_buf':
drivers/usb/storage/protocol.c:155:22: warning: comparison of distinct
pointer types lacks a cast [enabled by default]

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/protocol.c

index f54e5fea9230feadaa59ed7b47bdc2d94e26ae61..12e3c2fac64205f349530b4e9df9b49f37c85fdb 100644 (file)
@@ -152,7 +152,8 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
                return cnt;
 
        while (sg_miter_next(&miter) && cnt < buflen) {
-               unsigned int len = min(miter.length, buflen - cnt);
+               unsigned int len = min_t(unsigned int, miter.length,
+                               buflen - cnt);
 
                if (dir == FROM_XFER_BUF)
                        memcpy(buffer + cnt, miter.addr, len);