* [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code [not found] <1345365870-29831-1-git-send-email-Julia.Lawall@lip6.fr> @ 2012-08-19 8:44 ` Julia Lawall 2012-08-22 9:38 ` Kukjin Kim 0 siblings, 1 reply; 5+ messages in thread From: Julia Lawall @ 2012-08-19 8:44 UTC (permalink / raw) To: linux-arm-kernel 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 at 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> --- Perhaps -EINVAL is not the right value in this case. 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; } ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code 2012-08-19 8:44 ` [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code Julia Lawall @ 2012-08-22 9:38 ` Kukjin Kim 2012-08-22 11:40 ` Mark Brown 0 siblings, 1 reply; 5+ messages in thread From: Kukjin Kim @ 2012-08-22 9:38 UTC (permalink / raw) To: linux-arm-kernel 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 at p1 (\(ret < 0\|ret != 0\)) > { ... return ret; } > | > ret at 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; > } > ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code 2012-08-22 9:38 ` Kukjin Kim @ 2012-08-22 11:40 ` Mark Brown 2012-08-22 11:42 ` Julia Lawall 0 siblings, 1 reply; 5+ messages in thread From: Mark Brown @ 2012-08-22 11:40 UTC (permalink / raw) To: linux-arm-kernel On Wed, Aug 22, 2012 at 06:38:36PM +0900, Kukjin Kim wrote: > Julia Lawall wrote: > > 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) Please resend the patch to me so I can apply this. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120822/d8403bd2/attachment.sig> ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code 2012-08-22 11:40 ` Mark Brown @ 2012-08-22 11:42 ` Julia Lawall 2012-08-22 17:00 ` Mark Brown 0 siblings, 1 reply; 5+ messages in thread From: Julia Lawall @ 2012-08-22 11:42 UTC (permalink / raw) To: linux-arm-kernel 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 at 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> --- Perhaps -EINVAL is not the right value in this case. 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; } ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code 2012-08-22 11:42 ` Julia Lawall @ 2012-08-22 17:00 ` Mark Brown 0 siblings, 0 replies; 5+ messages in thread From: Mark Brown @ 2012-08-22 17:00 UTC (permalink / raw) To: linux-arm-kernel On Wed, Aug 22, 2012 at 01:42:47PM +0200, Julia Lawall wrote: > From: Julia Lawall <Julia.Lawall@lip6.fr> > > Initialize return variable before exiting on an error path. Applied, thanks. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120822/a09091e8/attachment.sig> ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-22 17:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1345365870-29831-1-git-send-email-Julia.Lawall@lip6.fr>
2012-08-19 8:44 ` [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code Julia Lawall
2012-08-22 9:38 ` Kukjin Kim
2012-08-22 11:40 ` Mark Brown
2012-08-22 11:42 ` Julia Lawall
2012-08-22 17:00 ` Mark Brown
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).