Re: Regression - Linux 4.9: ums_eneub6250 broken: transfer buffer not dma capable - Trace

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

 



On Mon, Apr 17, 2017 at 11:28:44AM +0200, Andreas Hartmann wrote:
> Hello!
> 
> Since Linux 4.9, ums_eneub6250 is broken. It's working fine if
> CONFIG_VMAP_STACK is disabled.
> 
> I would be glad if it would be fixed.

Ah, nice catch, thanks for finding this.

Does the patch below fix this for you?

thanks,

greg k-h

---------------------


diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c
index 369f3c24815a..6a227b142146 100644
--- a/drivers/usb/storage/ene_ub6250.c
+++ b/drivers/usb/storage/ene_ub6250.c
@@ -2180,21 +2180,29 @@ static int ene_sd_init(struct us_data *us)
 static int ene_init(struct us_data *us)
 {
 	int result;
-	u8  misc_reg03 = 0;
+	u8 *misc_reg03;
+	u8 reg03;
 	struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra);
 
-	result = ene_get_card_type(us, REG_CARD_STATUS, &misc_reg03);
+	misc_reg03 = kzalloc(1, GFP_KERNEL);
+	if (!misc_reg03)
+		return -ENOMEM;
+
+	result = ene_get_card_type(us, REG_CARD_STATUS, misc_reg03);
+	reg03 = misc_reg03[0];
+	kfree(misc_reg03);
+
 	if (result != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_ERROR;
 
-	if (misc_reg03 & 0x01) {
+	if (reg03 & 0x01) {
 		if (!info->SD_Status.Ready) {
 			result = ene_sd_init(us);
 			if (result != USB_STOR_XFER_GOOD)
 				return USB_STOR_TRANSPORT_ERROR;
 		}
 	}
-	if (misc_reg03 & 0x02) {
+	if (reg03 & 0x02) {
 		if (!info->MS_Status.Ready) {
 			result = ene_ms_init(us);
 			if (result != USB_STOR_XFER_GOOD)
@@ -2303,7 +2311,7 @@ static int ene_ub6250_probe(struct usb_interface *intf,
 			 const struct usb_device_id *id)
 {
 	int result;
-	u8  misc_reg03 = 0;
+	u8 *misc_reg03;
 	struct us_data *us;
 
 	result = usb_stor_probe1(&us, intf, id,
@@ -2328,18 +2336,26 @@ static int ene_ub6250_probe(struct usb_interface *intf,
 	if (result)
 		return result;
 
+	misc_reg03 = kzalloc(1, GFP_KERNEL);
+	if (!misc_reg03) {
+		usb_stor_disconnect(intf);
+		return -ENOMEM;
+	}
+
 	/* probe card type */
-	result = ene_get_card_type(us, REG_CARD_STATUS, &misc_reg03);
+	result = ene_get_card_type(us, REG_CARD_STATUS, misc_reg03);
 	if (result != USB_STOR_XFER_GOOD) {
+		kfree(misc_reg03);
 		usb_stor_disconnect(intf);
 		return USB_STOR_TRANSPORT_ERROR;
 	}
 
-	if (!(misc_reg03 & 0x01)) {
+	if (!(misc_reg03[0] & 0x01)) {
 		pr_info("ums_eneub6250: This driver only supports SD/MS cards. "
 			"It does not support SM cards.\n");
 	}
 
+	kfree(misc_reg03);
 	return result;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux