linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kukjin Kim <kgene.kim@samsung.com>
To: 'Julia Lawall' <Julia.Lawall@lip6.fr>, 'Ben Dooks' <ben-linux@fluff.org>
Cc: kernel-janitors@vger.kernel.org,
	'Grant Likely' <grant.likely@secretlab.ca>,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	spi-devel-general@lists.sourceforge.net,
	linux-kernel@vger.kernel.org,
	'Mark Brown' <broonie@opensource.wolfsonmicro.com>
Subject: RE: [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code
Date: Wed, 22 Aug 2012 18:38:36 +0900	[thread overview]
Message-ID: <1b3201cd8049$e753f720$b5fbe560$%kim@samsung.com> (raw)
In-Reply-To: <1345365870-29831-15-git-send-email-Julia.Lawall@lip6.fr>

Julia Lawall wrote:
> 
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Initialize return variable before exiting on an error path.
> 
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> (
> if@p1 (\(ret < 0\|ret != 0\))
>  { ... return ret; }
> |
> ret@p1 = 0
> )
> ... when != ret = e1
>     when != &ret
> *if(...)
> {
>   ... when != ret = e2
>       when forall
>  return ret;
> }
> 
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
Acked-by: Kukjin Kim <kgene.kim@samsung.com>

(Cc'ed Mark Brown who is handling spi for a moment)

> ---
> Perhaps -EINVAL is not the right value in this case.
> 
Well, if (pin_cs < 0) is true, it is really invalid value. So I think, it
makes sense :-)

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

>  drivers/spi/spi-s3c24xx.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c
> index 8ee7d79..a2a080b 100644
> --- a/drivers/spi/spi-s3c24xx.c
> +++ b/drivers/spi/spi-s3c24xx.c
> @@ -611,6 +611,7 @@ static int __devinit s3c24xx_spi_probe(struct
> platform_device *pdev)
>  	if (!pdata->set_cs) {
>  		if (pdata->pin_cs < 0) {
>  			dev_err(&pdev->dev, "No chipselect pin\n");
> +			err = -EINVAL;
>  			goto err_register;
>  		}
> 

  reply	other threads:[~2012-08-22  9:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1345365870-29831-1-git-send-email-Julia.Lawall@lip6.fr>
     [not found] ` <1345365870-29831-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
2012-08-19  8:44   ` [PATCH 12/14] drivers/spi/spi-coldfire-qspi.c: fix error return code Julia Lawall
2012-08-19  8:44   ` [PATCH 11/14] drivers/spi/spi-orion.c: " Julia Lawall
2012-08-19  8:44   ` [PATCH 10/14] drivers/spi/spi-ep93xx.c: " Julia Lawall
2012-08-22 16:12     ` H Hartley Sweeten
2012-08-19  8:44   ` [PATCH 9/14] drivers/spi/spi-omap-100k.c: " Julia Lawall
2012-08-19  8:44   ` [PATCH 14/14] drivers/spi/spi-s3c24xx.c: " Julia Lawall
2012-08-22  9:38     ` Kukjin Kim [this message]
2012-08-22 11:40       ` Mark Brown
2012-08-22 11:42         ` Julia Lawall
2012-08-22 17:00           ` Mark Brown

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='1b3201cd8049$e753f720$b5fbe560$%kim@samsung.com' \
    --to=kgene.kim@samsung.com \
    --cc=Julia.Lawall@lip6.fr \
    --cc=ben-linux@fluff.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=grant.likely@secretlab.ca \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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).