From: Julia Lawall <julia.lawall@lip6.fr>
To: walter harms <wharms@bfs.de>
Cc: Mark Brown <broonie@kernel.org>,
kernel-janitors@vger.kernel.org, linux-spi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/2 v2] spi: spi-ep93xx: fix PTR_ERR problem
Date: Sun, 30 Aug 2015 22:10:15 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1508302209040.2062@localhost6.localdomain6> (raw)
In-Reply-To: <55E34C0E.5000702@bfs.de>
Move initialization of msg->status up over the call to dev_err, in both
calls to ep93xx_spi_dma_prepare, and change the reference in the call to
dev_err to msg->status, to both fix the wrong argument to PTR_ERR in the
second case and to make the dev_err line a little shorter. This required
furthermore replacing %ld by %d, since msg->status is an integer.
The semantic match that finds the PTR_ERR problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,y;
@@
if (IS_ERR(x) || ...) {
... when any
when != IS_ERR(...)
(
PTR_ERR(x)
|
* PTR_ERR(y)
)
... when any
}
// </smpl>
Reorganizations at the suggestion of Walter Harms.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
v2: Reorganize the code, to solve the problem in a way that makes the
resulting code simpler.
drivers/spi/spi-ep93xx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
index bb00be8..73d0df6 100644
--- a/drivers/spi/spi-ep93xx.c
+++ b/drivers/spi/spi-ep93xx.c
@@ -559,16 +559,16 @@ static void ep93xx_spi_dma_transfer(struct ep93xx_spi *espi)
rxd = ep93xx_spi_dma_prepare(espi, DMA_DEV_TO_MEM);
if (IS_ERR(rxd)) {
- dev_err(&espi->pdev->dev, "DMA RX failed: %ld\n", PTR_ERR(rxd));
msg->status = PTR_ERR(rxd);
+ dev_err(&espi->pdev->dev, "DMA RX failed: %d\n", msg->status);
return;
}
txd = ep93xx_spi_dma_prepare(espi, DMA_MEM_TO_DEV);
if (IS_ERR(txd)) {
ep93xx_spi_dma_finish(espi, DMA_DEV_TO_MEM);
- dev_err(&espi->pdev->dev, "DMA TX failed: %ld\n", PTR_ERR(rxd));
msg->status = PTR_ERR(txd);
+ dev_err(&espi->pdev->dev, "DMA TX failed: %d\n", msg->status);
return;
}
prev parent reply other threads:[~2015-08-30 20:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-30 18:05 [PATCH 0/2] change PTR_ERR argument Julia Lawall
2015-08-30 18:05 ` [PATCH 1/2] ASoC: qcom: " Julia Lawall
2015-08-30 18:54 ` walter harms
2015-08-30 19:54 ` Julia Lawall
2015-09-03 21:36 ` [alsa-devel] " Kenneth Westfield
2015-09-03 21:33 ` Kenneth Westfield
2015-09-03 21:19 ` Kenneth Westfield
2015-09-14 18:04 ` Mark Brown
2015-09-17 8:46 ` Julia Lawall
2015-09-17 9:21 ` Mark Brown
2015-09-17 8:47 ` Julia Lawall
2015-08-30 18:05 ` [PATCH 2/2] spi: spi-ep93xx: " Julia Lawall
2015-08-30 18:31 ` walter harms
2015-08-30 20:10 ` Julia Lawall [this message]
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.1508302209040.2062@localhost6.localdomain6 \
--to=julia.lawall@lip6.fr \
--cc=broonie@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=wharms@bfs.de \
/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