All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>,
	Bill Pemberton <wfp5p@virginia.edu>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	"Lad, Prabhakar" <prabhakar.csengg@gmail.com>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] [media] dt3155v4l: unlock on error path
Date: Tue, 09 Apr 2013 05:20:19 +0000	[thread overview]
Message-ID: <alpine.DEB.2.02.1304090719480.2019@hadrien> (raw)
In-Reply-To: <20130409051540.GA1516@longonot.mountain>

On Tue, 9 Apr 2013, Dan Carpenter wrote:

> We should unlock here and do some cleanup before returning.
>
> We can't actually hit this return path with the current code, so this
> patch is a basically a cleanup and doesn't change how the code works.

Why keep the return path then?  If the code is there, someone reading it
could naturally assume that it is necessary.

julia

>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.c b/drivers/staging/media/dt3155v4l/dt3155v4l.c
> index 073b3b3..3da17bc 100644
> --- a/drivers/staging/media/dt3155v4l/dt3155v4l.c
> +++ b/drivers/staging/media/dt3155v4l/dt3155v4l.c
> @@ -398,7 +398,7 @@ dt3155_open(struct file *filp)
>  		pd->field_count = 0;
>  		ret = vb2_queue_init(pd->q);
>  		if (ret < 0)
> -			return ret;
> +			goto err_free_q;
>  		INIT_LIST_HEAD(&pd->dmaq);
>  		spin_lock_init(&pd->lock);
>  		/* disable all irqs, clear all irq flags */
> @@ -407,11 +407,11 @@ dt3155_open(struct file *filp)
>  		ret = request_irq(pd->pdev->irq, dt3155_irq_handler_even,
>  						IRQF_SHARED, DT3155_NAME, pd);
>  		if (ret)
> -			goto err_request_irq;
> +			goto err_free_q;
>  	}
>  	pd->users++;
>  	return 0; /* success */
> -err_request_irq:
> +err_free_q:
>  	kfree(pd->q);
>  	pd->q = NULL;
>  err_alloc_queue:
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

WARNING: multiple messages have this Message-ID (diff)
From: Julia Lawall <julia.lawall@lip6.fr>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>,
	Bill Pemberton <wfp5p@virginia.edu>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	"Lad, Prabhakar" <prabhakar.csengg@gmail.com>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] [media] dt3155v4l: unlock on error path
Date: Tue, 9 Apr 2013 07:20:19 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.02.1304090719480.2019@hadrien> (raw)
In-Reply-To: <20130409051540.GA1516@longonot.mountain>

On Tue, 9 Apr 2013, Dan Carpenter wrote:

> We should unlock here and do some cleanup before returning.
>
> We can't actually hit this return path with the current code, so this
> patch is a basically a cleanup and doesn't change how the code works.

Why keep the return path then?  If the code is there, someone reading it
could naturally assume that it is necessary.

julia

>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.c b/drivers/staging/media/dt3155v4l/dt3155v4l.c
> index 073b3b3..3da17bc 100644
> --- a/drivers/staging/media/dt3155v4l/dt3155v4l.c
> +++ b/drivers/staging/media/dt3155v4l/dt3155v4l.c
> @@ -398,7 +398,7 @@ dt3155_open(struct file *filp)
>  		pd->field_count = 0;
>  		ret = vb2_queue_init(pd->q);
>  		if (ret < 0)
> -			return ret;
> +			goto err_free_q;
>  		INIT_LIST_HEAD(&pd->dmaq);
>  		spin_lock_init(&pd->lock);
>  		/* disable all irqs, clear all irq flags */
> @@ -407,11 +407,11 @@ dt3155_open(struct file *filp)
>  		ret = request_irq(pd->pdev->irq, dt3155_irq_handler_even,
>  						IRQF_SHARED, DT3155_NAME, pd);
>  		if (ret)
> -			goto err_request_irq;
> +			goto err_free_q;
>  	}
>  	pd->users++;
>  	return 0; /* success */
> -err_request_irq:
> +err_free_q:
>  	kfree(pd->q);
>  	pd->q = NULL;
>  err_alloc_queue:
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  reply	other threads:[~2013-04-09  5:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-09  5:15 [patch] [media] dt3155v4l: unlock on error path Dan Carpenter
2013-04-09  5:15 ` Dan Carpenter
2013-04-09  5:20 ` Julia Lawall [this message]
2013-04-09  5:20   ` Julia Lawall
2013-04-09  6:28   ` Dan Carpenter
2013-04-09  6:28     ` Dan Carpenter
2013-04-09  6:14 ` Hans Verkuil
2013-04-09  6:14   ` Hans Verkuil

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=alpine.DEB.2.02.1304090719480.2019@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=dan.carpenter@oracle.com \
    --cc=hans.verkuil@cisco.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=prabhakar.csengg@gmail.com \
    --cc=wfp5p@virginia.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.