All of lore.kernel.org
 help / color / mirror / Atom feed
From: fangxiaozhi 00110321 <fangxiaozhi@huawei.com>
To: <linux-usb@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <zihan@huawei.com>,
	<Lin.Lei@huawei.com>, <greg@kroah.com>, <neil.yi@huawei.com>,
	<wangyuhua@huawei.com>, <huqiao36@huawei.com>, <balbi@ti.com>,
	<mdharm-usb@one-eyed-alien.net>, <sebastian@breakpoint.cc>
Subject: [PATCH 1/1]linux-usb: fix the idProduct value to be compatible with current CPU in initializers.c
Date: Thu, 7 Feb 2013 15:32:07 +0800	[thread overview]
Message-ID: <fe8ad35c629c.629cfe8ad35c@huawei.com> (raw)


From: fangxiaozhi <huananhu@huawei.com>

1. The idProduct is little endian, so make sure its value to be compatible with the current CPU. Make no break on big endian processors.

Signed-off-by: fangxiaozhi <huananhu@huawei.com>
--------------------------------------------------------------------
diff -uprN linux-3.8-rc6_orig/drivers/usb/storage/initializers.c linux-3.8-rc6/drivers/usb/storage/initializers.c
--- linux-3.8-rc6_orig/drivers/usb/storage/initializers.c	2013-02-06 14:48:51.564355283 +0800
+++ linux-3.8-rc6/drivers/usb/storage/initializers.c	2013-02-07 15:29:59.929482630 +0800
@@ -147,7 +147,7 @@ static int usb_stor_huawei_dongles_pid(s
 	int idProduct;
 
 	idesc = &us->pusb_intf->cur_altsetting->desc;
-	idProduct = us->pusb_dev->descriptor.idProduct;
+	idProduct = le16_to_cpu(us->pusb_dev->descriptor.idProduct);
 	/* The first port is CDROM,
 	 * means the dongle in the single port mode,
 	 * and a switch command is required to be sent. */
@@ -169,7 +169,7 @@ int usb_stor_huawei_init(struct us_data
 	int result = 0;
 
 	if (usb_stor_huawei_dongles_pid(us)) {
-		if (us->pusb_dev->descriptor.idProduct >= 0x1446)
+		if (le16_to_cpu(us->pusb_dev->descriptor.idProduct) >= 0x1446)
 			result = usb_stor_huawei_scsi_init(us);
 		else
 			result = usb_stor_huawei_feature_init(us);


             reply	other threads:[~2013-02-07  7:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-07  7:32 fangxiaozhi 00110321 [this message]
2013-02-07 11:38 ` [PATCH 1/1]linux-usb: fix the idProduct value to be compatible with current CPU in initializers.c Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fe8ad35c629c.629cfe8ad35c@huawei.com \
    --to=fangxiaozhi@huawei.com \
    --cc=Lin.Lei@huawei.com \
    --cc=balbi@ti.com \
    --cc=greg@kroah.com \
    --cc=huqiao36@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mdharm-usb@one-eyed-alien.net \
    --cc=neil.yi@huawei.com \
    --cc=sebastian@breakpoint.cc \
    --cc=wangyuhua@huawei.com \
    --cc=zihan@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.