diff options
author | Mike Isely <isely@pobox.com> | 2008-08-30 16:11:40 -0500 |
---|---|---|
committer | Mike Isely <isely@pobox.com> | 2008-08-30 16:11:40 -0500 |
commit | 3757649a964c5c9a327c83911dcc7743636d5e13 (patch) | |
tree | e86712cb7ac04f311feb94452516d825af4f5afe /linux/drivers/media/video | |
parent | 3f4ff57d35135b562a224a6a2eefcbdb27aec539 (diff) | |
download | mediapointer-dvb-s2-3757649a964c5c9a327c83911dcc7743636d5e13.tar.gz mediapointer-dvb-s2-3757649a964c5c9a327c83911dcc7743636d5e13.tar.bz2 |
pvrusb2: Fail gracefully if an alien USB ID is used
From: Mike Isely <isely@pobox.com>
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.
Priority: normal
Signed-off-by: Mike Isely <isely@pobox.com>
Diffstat (limited to 'linux/drivers/media/video')
-rw-r--r-- | linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 70ed24e9a..0fc02ce96 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -1932,7 +1932,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; @@ -1942,6 +1942,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); |