diff options
author | Tobias Lorenz <tobias.lorenz@gmx.net> | 2008-01-29 04:43:13 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-02-18 17:15:09 +0300 |
commit | c3f686f152767b84893e474acd1a7758988dc369 (patch) | |
tree | 38422271ed6210b08b95d08457e1c0cf371443ce /drivers/media/radio | |
parent | 532fe65205253aef1ce5c0c76d2d8d303fb3fe71 (diff) | |
download | linux-c3f686f152767b84893e474acd1a7758988dc369.tar.xz |
V4L/DVB (7108): radio-si470x.c: check-after-use
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 'drivers/media/radio')
-rw-r--r-- | drivers/media/radio/radio-si470x.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index a2975c8b0095..7fdee3cc6e02 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c @@ -1439,11 +1439,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); |