LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Julia Lawall <Julia.Lawall@lip6.fr>
To: Michal Simek <michal.simek@xilinx.com>
Cc: kernel-janitors@vger.kernel.org,
	"Sören Brinkmann" <soren.brinkmann@xilinx.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/8] net: Xilinx: fix error return code
Date: Mon, 29 Dec 2014 18:04:36 +0100	[thread overview]
Message-ID: <1419872683-32709-2-git-send-email-Julia.Lawall@lip6.fr> (raw)
In-Reply-To: <1419872683-32709-1-git-send-email-Julia.Lawall@lip6.fr>

Return a negative error code on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/net/ethernet/xilinx/ll_temac_main.c   |    2 ++
 drivers/net/ethernet/xilinx/xilinx_emaclite.c |    1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 9c2d91e..dbcbf0c 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -1043,6 +1043,7 @@ static int temac_of_probe(struct platform_device *op)
 	lp->regs = of_iomap(op->dev.of_node, 0);
 	if (!lp->regs) {
 		dev_err(&op->dev, "could not map temac regs.\n");
+		rc = -ENOMEM;
 		goto nodev;
 	}
 
@@ -1062,6 +1063,7 @@ static int temac_of_probe(struct platform_device *op)
 	np = of_parse_phandle(op->dev.of_node, "llink-connected", 0);
 	if (!np) {
 		dev_err(&op->dev, "could not find DMA node\n");
+		rc = -ENODEV;
 		goto err_iounmap;
 	}
 
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 2485879..9d4ce38 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1109,6 +1109,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
 	res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0);
 	if (!res) {
 		dev_err(dev, "no IRQ found\n");
+		rc = -ENXIO;
 		goto error;
 	}
 


  reply	other threads:[~2014-12-29 17:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-29 17:04 [PATCH 0/8] " Julia Lawall
2014-12-29 17:04 ` Julia Lawall [this message]
2015-01-01  0:20   ` [PATCH 1/8] net: Xilinx: " David Miller
2014-12-29 17:04 ` [PATCH 2/8] myri10ge: " Julia Lawall
2015-01-01  0:20   ` David Miller
2014-12-29 17:04 ` [PATCH 3/8] soc: ti: knav_qmss_queue: " Julia Lawall
2014-12-29 17:04 ` [PATCH 4/8] drm: " Julia Lawall
2014-12-29 17:04 ` [PATCH 5/8] net: sun4i-emac: " Julia Lawall
2015-01-01  0:20   ` David Miller
2014-12-29 17:04 ` [PATCH 6/8] adm8211: " Julia Lawall
2015-01-15 12:45   ` Kalle Valo
2014-12-29 17:04 ` [PATCH 7/8] net: axienet: " Julia Lawall
2015-01-01  0:19   ` David Miller
2014-12-29 17:04 ` [PATCH 8/8] ath10k: " Julia Lawall
2015-01-13 14:16   ` Kalle Valo

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=1419872683-32709-2-git-send-email-Julia.Lawall@lip6.fr \
    --to=julia.lawall@lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=netdev@vger.kernel.org \
    --cc=soren.brinkmann@xilinx.com \
    --subject='Re: [PATCH 1/8] net: Xilinx: fix error return code' \
    /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

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