diff options
author | Mike Isely <isely@pobox.com> | 2008-08-30 23:11:40 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 13:36:57 +0200 |
commit | fe15f13679bf52bb5c8acb8b4847e6d73ba62c17 (patch) | |
tree | 2b64c12e10c0ca892e3cf9307059e5e682780316 /drivers/media/video/pvrusb2 | |
parent | V4L/DVB (8894): pvrusb2: Remove BKL (diff) | |
download | linux-fe15f13679bf52bb5c8acb8b4847e6d73ba62c17.tar.xz linux-fe15f13679bf52bb5c8acb8b4847e6d73ba62c17.zip |
V4L/DVB (8895): pvrusb2: Fail gracefully if an alien USB ID is used
The driver includes an internal table specifying additional
information on a per device-type basis. This works great until
somebody tries to run-time associate another USB ID with the driver.
This change should hopefully allow the driver to fail gracefully under
such a circumstance.
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pvrusb2')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index c8dedbab6e39..a7d636f3f9b6 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -1915,7 +1915,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, const struct usb_device_id *devid) { unsigned int idx,cnt1,cnt2,m; - struct pvr2_hdw *hdw; + struct pvr2_hdw *hdw = NULL; int valid_std_mask; struct pvr2_ctrl *cptr; const struct pvr2_device_desc *hdw_desc; @@ -1925,6 +1925,16 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, hdw_desc = (const struct pvr2_device_desc *)(devid->driver_info); + if (hdw_desc == NULL) { + pvr2_trace(PVR2_TRACE_INIT, "pvr2_hdw_create:" + " No device description pointer," + " unable to continue."); + pvr2_trace(PVR2_TRACE_INIT, "If you have a new device type," + " please contact Mike Isely <isely@pobox.com>" + " to get it included in the driver\n"); + goto fail; + } + hdw = kzalloc(sizeof(*hdw),GFP_KERNEL); pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_create: hdw=%p, type \"%s\"", hdw,hdw_desc->description); |