diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-28 22:43:13 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-28 22:43:13 +0000 |
commit | a2f115b3bfacbf8b8a22bca80413eb1ae997a18b (patch) | |
tree | f9f92881031bfa9e26ed7e8a26598802524a6f84 /linux/drivers/media/radio/radio-si470x.c | |
parent | 721d7a5bbbe35a229007ca71acd9eb2276439b14 (diff) | |
download | mediapointer-dvb-s2-a2f115b3bfacbf8b8a22bca80413eb1ae997a18b.tar.gz mediapointer-dvb-s2-a2f115b3bfacbf8b8a22bca80413eb1ae997a18b.tar.bz2 |
radio-si470x.c: check-after-use
From: Tobias Lorenz <tobias.lorenz@gmx.net>
Adrian used the coverity checker against radio-si470x and found this:
> The Coverity checker spotted the following check-after-use in
> drivers/media/radio/radio-si470x.c:
>
> <-- snip -->
> static void si470x_usb_driver_disconnect(struct usb_interface *intf)
> {
> struct si470x_device *radio = usb_get_intfdata(intf);
>
> del_timer_sync(&radio->timer); <------------------
> flush_scheduled_work();
>
> usb_set_intfdata(intf, NULL);
> if (radio) { <------------------
> video_unregister_device(radio->videodev);
> kfree(radio->buffer);
> kfree(radio);
> }
> }
> <-- snip -->
>
> Either "radio" can be NULL and this case has to be properly handled or
> the NULL check is not required.
These two lines should indeed better be inside the if statement.
Signed-off-by: Tobias Lorenz <tobias.lorenz@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/radio/radio-si470x.c')
-rw-r--r-- | linux/drivers/media/radio/radio-si470x.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/linux/drivers/media/radio/radio-si470x.c b/linux/drivers/media/radio/radio-si470x.c index ed64929dc..0448166ce 100644 --- a/linux/drivers/media/radio/radio-si470x.c +++ b/linux/drivers/media/radio/radio-si470x.c @@ -1440,11 +1440,10 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf) { struct si470x_device *radio = usb_get_intfdata(intf); - del_timer_sync(&radio->timer); - flush_scheduled_work(); - usb_set_intfdata(intf, NULL); if (radio) { + del_timer_sync(&radio->timer); + flush_scheduled_work(); video_unregister_device(radio->videodev); kfree(radio->buffer); kfree(radio); |