linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/4] drivers/mmc/host/omap.c: fix error return code
       [not found] <1347869728-2696-1-git-send-email-peter.senna@gmail.com>
@ 2012-09-17  8:15 ` Peter Senna Tschudin
  2012-09-17  8:15 ` [PATCH 3/4] drivers/mmc/host/omap_hsmmc.c: " Peter Senna Tschudin
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Senna Tschudin @ 2012-09-17  8:15 UTC (permalink / raw)
  To: jarkko.lavinen
  Cc: cjb, linux-omap, linux-mmc, linux-kernel, kernel-janitors,
	Peter Senna Tschudin

From: Peter Senna Tschudin <peter.senna@gmail.com>

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

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: Peter Senna Tschudin <peter.senna@gmail.com>
---
 drivers/mmc/host/omap.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 48ad361..d468f51 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1369,8 +1369,10 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
 	host->irq = irq;
 	host->phys_base = host->mem_res->start;
 	host->virt_base = ioremap(res->start, resource_size(res));
-	if (!host->virt_base)
+	if (!host->virt_base) {
+		ret = -ENOMEM;
 		goto err_ioremap;
+	}
 
 	host->iclk = clk_get(&pdev->dev, "ick");
 	if (IS_ERR(host->iclk)) {
@@ -1438,8 +1440,10 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
 	host->reg_shift = (cpu_is_omap7xx() ? 1 : 2);
 
 	host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0);
-	if (!host->mmc_omap_wq)
+	if (!host->mmc_omap_wq) {
+		err = -ENOMEM;
 		goto err_plat_cleanup;
+	}
 
 	for (i = 0; i < pdata->nr_slots; i++) {
 		ret = mmc_omap_new_slot(host, i);
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/4] drivers/mmc/host/omap_hsmmc.c: fix error return code
       [not found] <1347869728-2696-1-git-send-email-peter.senna@gmail.com>
  2012-09-17  8:15 ` [PATCH 2/4] drivers/mmc/host/omap.c: fix error return code Peter Senna Tschudin
@ 2012-09-17  8:15 ` Peter Senna Tschudin
  2012-09-17 18:11   ` S, Venkatraman
  1 sibling, 1 reply; 3+ messages in thread
From: Peter Senna Tschudin @ 2012-09-17  8:15 UTC (permalink / raw)
  To: svenkatr
  Cc: cjb, linux-mmc, linux-omap, linux-kernel, kernel-janitors,
	Peter Senna Tschudin

From: Peter Senna Tschudin <peter.senna@gmail.com>

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

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: Peter Senna Tschudin <peter.senna@gmail.com>
---
 drivers/mmc/host/omap_hsmmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index e59ac62..c8a2b36 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1893,6 +1893,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
 		if (pdata->init(&pdev->dev) != 0) {
 			dev_dbg(mmc_dev(host->mmc),
 				"Unable to configure MMC IRQs\n");
+			ret = -ENXIO;
 			goto err_irq_cd_init;
 		}
 	}
-- 
1.7.11.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/4] drivers/mmc/host/omap_hsmmc.c: fix error return code
  2012-09-17  8:15 ` [PATCH 3/4] drivers/mmc/host/omap_hsmmc.c: " Peter Senna Tschudin
@ 2012-09-17 18:11   ` S, Venkatraman
  0 siblings, 0 replies; 3+ messages in thread
From: S, Venkatraman @ 2012-09-17 18:11 UTC (permalink / raw)
  To: Peter Senna Tschudin
  Cc: cjb, linux-mmc, linux-omap, linux-kernel, kernel-janitors

On Mon, Sep 17, 2012 at 1:45 PM, Peter Senna Tschudin
<peter.senna@gmail.com> wrote:
> From: Peter Senna Tschudin <peter.senna@gmail.com>
>
> Convert a nonnegative error return code to a negative one, as returned
> elsewhere in the function.
>
> 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: Peter Senna Tschudin <peter.senna@gmail.com>

Looks good.
Acked-by: Venkatraman S <svenkatr@ti.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-17 18:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1347869728-2696-1-git-send-email-peter.senna@gmail.com>
2012-09-17  8:15 ` [PATCH 2/4] drivers/mmc/host/omap.c: fix error return code Peter Senna Tschudin
2012-09-17  8:15 ` [PATCH 3/4] drivers/mmc/host/omap_hsmmc.c: " Peter Senna Tschudin
2012-09-17 18:11   ` S, Venkatraman

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).