summaryrefslogtreecommitdiff
path: root/drivers/media/usb/dvb-usb-v2
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-02-22 15:10:49 (GMT)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-02-23 10:19:39 (GMT)
commit6cf5dad17e913fce1ccb0c38e199eff15b0f03cc (patch)
treeb039fae16d8290e8d54e4e614a1a0fb3dfd7e34a /drivers/media/usb/dvb-usb-v2
parent41b44e35ba9b34e50a65c05ecf7642c07bd3e8aa (diff)
downloadlinux-6cf5dad17e913fce1ccb0c38e199eff15b0f03cc.tar.xz
[media] media_device: move allocation out of media_device_*_init
Right now, media_device_pci_init and media_device_usb_init does media_device allocation internaly. That preents its usage when the media_device struct is embedded on some other structure. Move memory allocation outside it, to make it more generic. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/dvb-usb-v2')
-rw-r--r--drivers/media/usb/dvb-usb-v2/dvb_usb_core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
index 5825025..3fbb2cd 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
@@ -408,10 +408,12 @@ static int dvb_usbv2_media_device_init(struct dvb_usb_adapter *adap)
struct dvb_usb_device *d = adap_to_d(adap);
struct usb_device *udev = d->udev;
- mdev = media_device_usb_init(udev, d->name);
+ mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
if (!mdev)
return -ENOMEM;
+ media_device_usb_init(mdev, udev, d->name);
+
dvb_register_media_controller(&adap->dvb_adap, mdev);
dev_info(&d->udev->dev, "media controller created\n");