linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: Andy Walls <awalls@md.metrocast.net>
Cc: mchehab@infradead.org, linux-kernel@vger.kernel.org,
	Tejun Heo <tj@kernel.org>, Ian Armstrong <ian@iarmst.demon.co.uk>,
	ivtv-devel@ivtvdriver.org, linux-media@vger.kernel.org
Subject: Re: [PATCH] VIDEO: ivtvfb, remove unneeded NULL test
Date: Sun, 04 Jul 2010 09:24:29 +0200	[thread overview]
Message-ID: <4C30372D.9050304@suse.cz> (raw)
In-Reply-To: <1278216707.2644.32.camel@localhost>

On 07/04/2010 06:11 AM, Andy Walls wrote:
> You missed an identical instance of the useless test 10 lines prior in
> ivtvfb_callback_init(). :)

Ah, thank you for pointing out. Find my comment below.

> --- a/drivers/media/video/ivtv/ivtvfb.c
> +++ b/drivers/media/video/ivtv/ivtvfb.c
> @@ -1201,9 +1201,14 @@ static int ivtvfb_init_card(struct ivtv *itv)
>  static int __init ivtvfb_callback_init(struct device *dev, void *p)
>  {
>         struct v4l2_device *v4l2_dev = dev_get_drvdata(dev);
> -       struct ivtv *itv = container_of(v4l2_dev, struct ivtv, v4l2_dev);
> +       struct ivtv *itv;
>  
> -       if (itv && (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) {
> +       if (v4l2_dev == NULL)
> +               return 0;
> +
> +       itv = container_of(v4l2_dev, struct ivtv, v4l2_dev);
> +
> +       if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) {
>                 if (ivtvfb_init_card(itv) == 0) {
>                         IVTVFB_INFO("Framebuffer registered on %s\n",
>                                         itv->v4l2_dev.name);
> @@ -1216,10 +1221,16 @@ static int __init ivtvfb_callback_init(struct device *de
>  static int ivtvfb_callback_cleanup(struct device *dev, void *p)
>  {
>         struct v4l2_device *v4l2_dev = dev_get_drvdata(dev);
> -       struct ivtv *itv = container_of(v4l2_dev, struct ivtv, v4l2_dev);
> -       struct osd_info *oi = itv->osd_info;
> +       struct ivtv *itv;
> +       struct osd_info *oi;
> +
> +       if (v4l2_dev == NULL)
> +               return 0;

>From my POV I NACK this. Given that it never triggered and drvdata are
set in v4l2_device_register called from ivtv_probe I can't see how
v4l2_dev be NULL. Could you elaborate?

-- 
js
suse labs

  reply	other threads:[~2010-07-04  7:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-22 11:41 [PATCH] VIDEO: ivtvfb, remove unneeded NULL test Jiri Slaby
2010-07-04  4:11 ` Andy Walls
2010-07-04  7:24   ` Jiri Slaby [this message]
2010-07-04 13:22     ` Andy Walls
2010-07-05  7:10       ` Jiri Slaby
2010-07-05 16:19         ` Andy Walls
2010-07-19 17:39           ` [PATCH 1/1] " Jiri Slaby
2010-07-19 21:39             ` Andy Walls

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=4C30372D.9050304@suse.cz \
    --to=jslaby@suse.cz \
    --cc=awalls@md.metrocast.net \
    --cc=ian@iarmst.demon.co.uk \
    --cc=ivtv-devel@ivtvdriver.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=tj@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).