[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>
这个提交包含在:
Mauro Carvalho Chehab
2016-02-22 12:10:49 -03:00
父节点 41b44e35ba
当前提交 6cf5dad17e
修改 9 个文件,包含 55 行新增56 行删除

查看文件

@@ -367,10 +367,12 @@ static void *siano_media_device_register(struct smsusb_device_t *dev,
struct sms_board *board = sms_get_board(board_id);
int ret;
mdev = media_device_usb_init(udev, board->name);
mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
if (!mdev)
return NULL;
media_device_usb_init(mdev, udev, board->name);
ret = media_device_register(mdev);
if (ret) {
media_device_cleanup(mdev);