From: Antti Palosaari Date: Tue, 5 Jun 2012 23:37:46 +0000 (-0300) Subject: [media] dvb_usb_v2: ensure driver_info is not null X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0a8673569ff92d7dd6c07153696d1975d13a3b99;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [media] dvb_usb_v2: ensure driver_info is not null It could be null in case of driver does not set it properly, like missing dynamic ID handling. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_init.c b/drivers/media/dvb/dvb-usb/dvb_usb_init.c index a2beb60908d1..3078371d626b 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb_init.c +++ b/drivers/media/dvb/dvb-usb/dvb_usb_init.c @@ -258,10 +258,18 @@ int dvb_usbv2_device_init_(struct usb_interface *intf, struct dvb_usb_device *d = NULL; struct dvb_usb_driver_info *driver_info = (struct dvb_usb_driver_info *) id->driver_info; - const struct dvb_usb_device_properties *props = driver_info->props; + const struct dvb_usb_device_properties *props; int ret = -ENOMEM; bool cold = false; + if (!id->driver_info) { + pr_err("%s: driver_info is null", KBUILD_MODNAME); + ret = -ENODEV; + goto err; + } + + props = driver_info->props; + d = kzalloc(sizeof(struct dvb_usb_device), GFP_KERNEL); if (d == NULL) { err("no memory for 'struct dvb_usb_device'"); @@ -326,7 +334,8 @@ int dvb_usbv2_device_init_(struct usb_interface *intf, err_kfree: kfree(d->priv); kfree(d); - +err: + pr_debug("%s: failed=%d\n", __func__, ret); return ret; }