* [PATCH -next] spi: tegra20-slink: fix return value check in tegra_slink_init_dma_param()
@ 2013-12-14 4:42 Wei Yongjun
[not found] ` <CAPgLHd-CMEbwqXXvEK7ybSYrDeJPQfkbi+LgRepke_U=WoKmkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2013-12-14 4:42 UTC (permalink / raw)
To: ldewangan-DDmLM1+adcrQT0dZR+AlfA, broonie-DgEjT+Ai2ygdnm+yROfE0A,
swarren-3lzwWm7+Weoh9ZMKESR00Q,
thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
grant.likely-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY,
linux-spi-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
In case of error, the function dma_request_slave_channel() returns
NULL pointer not ERR_PTR(). The IS_ERR() test in the return value
check should be replaced with NULL test.
Signed-off-by: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
---
drivers/spi/spi-tegra20-slink.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index 1e61e98..3643178 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -614,12 +614,9 @@ static int tegra_slink_init_dma_param(struct tegra_slink_data *tspi,
dma_chan = dma_request_slave_channel(tspi->dev,
dma_to_memory ? "rx" : "tx");
- if (IS_ERR(dma_chan)) {
- ret = PTR_ERR(dma_chan);
- if (ret != -EPROBE_DEFER)
- dev_err(tspi->dev,
- "Dma channel is not available: %d\n", ret);
- return ret;
+ if (!dma_chan) {
+ dev_err(tspi->dev, "Dma channel is not available: %d\n", ret);
+ return -ENODEV;
}
dma_buf = dma_alloc_coherent(tspi->dev, tspi->dma_buf_size,
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] spi: tegra20-slink: fix return value check in tegra_slink_init_dma_param()
[not found] ` <CAPgLHd-CMEbwqXXvEK7ybSYrDeJPQfkbi+LgRepke_U=WoKmkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-12-16 16:59 ` Stephen Warren
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Warren @ 2013-12-16 16:59 UTC (permalink / raw)
To: Wei Yongjun, ldewangan-DDmLM1+adcrQT0dZR+AlfA,
broonie-DgEjT+Ai2ygdnm+yROfE0A,
thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
grant.likely-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY,
linux-spi-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
On 12/13/2013 09:42 PM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
>
> In case of error, the function dma_request_slave_channel() returns
> NULL pointer not ERR_PTR(). The IS_ERR() test in the return value
> diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
> dma_chan = dma_request_slave_channel(tspi->dev,
> dma_to_memory ? "rx" : "tx");
> - if (IS_ERR(dma_chan)) {
...
> + if (!dma_chan) {
The code should be calling dma_request_slave_channel_or_reason() rather
than dma_request_slave_channel(). Dan Williams provided a patch to fix
this, which I've now applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-16 16:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-14 4:42 [PATCH -next] spi: tegra20-slink: fix return value check in tegra_slink_init_dma_param() Wei Yongjun
[not found] ` <CAPgLHd-CMEbwqXXvEK7ybSYrDeJPQfkbi+LgRepke_U=WoKmkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-12-16 16:59 ` Stephen Warren
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).