USB: storage: properly handle the endian issues of idProduct
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> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
		
					parent
					
						
							
								9742aecda4
							
						
					
				
			
			
				commit
				
					
						cd060956c5
					
				
			
		
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -147,7 +147,7 @@ static int usb_stor_huawei_dongles_pid(struct us_data *us) | ||||||
| 	int idProduct; | 	int idProduct; | ||||||
| 
 | 
 | ||||||
| 	idesc = &us->pusb_intf->cur_altsetting->desc; | 	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,
 | 	/* The first port is CDROM,
 | ||||||
| 	 * means the dongle in the single port mode, | 	 * means the dongle in the single port mode, | ||||||
| 	 * and a switch command is required to be sent. */ | 	 * and a switch command is required to be sent. */ | ||||||
|  | @ -169,7 +169,7 @@ int usb_stor_huawei_init(struct us_data *us) | ||||||
| 	int result = 0; | 	int result = 0; | ||||||
| 
 | 
 | ||||||
| 	if (usb_stor_huawei_dongles_pid(us)) { | 	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); | 			result = usb_stor_huawei_scsi_init(us); | ||||||
| 		else | 		else | ||||||
| 			result = usb_stor_huawei_feature_init(us); | 			result = usb_stor_huawei_feature_init(us); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 fangxiaozhi
				fangxiaozhi