summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Caumont <lcaumont2@gmail.com>2017-11-11 20:44:46 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-14 11:53:00 +0300
commit9a11204d2b26324636ff54f8d28095ed5dd17e91 (patch)
treea09426944303823a3e8b19d0d0ae9c5295d13ba1
parente547af2582b53354073790df012ba3f852526410 (diff)
downloadlinux-9a11204d2b26324636ff54f8d28095ed5dd17e91.tar.xz
media: dvb: i2c transfers over usb cannot be done from stack
commit 6d33377f2abbf9f0e561b116dd468d1c3ff36a6a upstream. Signed-off-by: Laurent Caumont <lcaumont2@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/media/usb/dvb-usb/dibusb-common.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c
index 8207e6900656..bcacb0f22028 100644
--- a/drivers/media/usb/dvb-usb/dibusb-common.c
+++ b/drivers/media/usb/dvb-usb/dibusb-common.c
@@ -223,8 +223,20 @@ EXPORT_SYMBOL(dibusb_i2c_algo);
int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val)
{
- u8 wbuf[1] = { offs };
- return dibusb_i2c_msg(d, 0x50, wbuf, 1, val, 1);
+ u8 *buf;
+ int rc;
+
+ buf = kmalloc(2, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
+
+ buf[0] = offs;
+
+ rc = dibusb_i2c_msg(d, 0x50, &buf[0], 1, &buf[1], 1);
+ *val = buf[1];
+ kfree(buf);
+
+ return rc;
}
EXPORT_SYMBOL(dibusb_read_eeprom_byte);