mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tobias Lorenz <tobias.lorenz@gmx.net>
To: Oliver Neukum <oliver@neukum.org>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>,
	Adrian Bunk <bunk@kernel.org>,
	video4linux-list@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] radio-si470x.c: check-after-use
Date: Tue, 29 Jan 2008 21:37:17 +0100	[thread overview]
Message-ID: <200801292137.18035.tobias.lorenz@gmx.net> (raw)
In-Reply-To: <200801292037.36647.oliver@neukum.org>

Hi,

> > > 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. The patch for this is below.
> 
> No, in disconnect intfdata must be valid. Any check for NULL is wrong
> there.

Why hadn't anybody told me that earlier? :-)
I removed the complete check for radio==NULL.
See the patch below.

Thanks,
  Toby


Signed-off-by: Tobias Lorenz <tobias.lorenz@gmx.net>
--- linux-2.6.23/drivers/media/radio/radio-si470x.c     2008-01-23 00:01:07.000000000 +0100
+++ linux-2.6.23.new/drivers/media/radio/radio-si470x.c 2008-01-27 15:31:42.000000000 +0100
@@ -1441,13 +1441,11 @@ static void si470x_usb_driver_disconnect
        struct si470x_device *radio = usb_get_intfdata(intf);

        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);
-       }
+       del_timer_sync(&radio->timer);
+       flush_scheduled_work();
+       video_unregister_device(radio->videodev);
+       kfree(radio->buffer);
+       kfree(radio);
 }

      reply	other threads:[~2008-01-29 20:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-28 22:13 media/radio/radio-si470x.c: check-after-use Adrian Bunk
2008-01-28 22:43 ` [PATCH] radio-si470x.c: check-after-use Tobias Lorenz
2008-01-29 19:37   ` Oliver Neukum
2008-01-29 20:37     ` Tobias Lorenz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200801292137.18035.tobias.lorenz@gmx.net \
    --to=tobias.lorenz@gmx.net \
    --cc=bunk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=oliver@neukum.org \
    --cc=video4linux-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®