* [PATCH v2] ASoC: sh: rz-ssi: Improve error handling in rz_ssi_dma_request function
@ 2021-08-14 18:01 ` Biju Das
0 siblings, 0 replies; 2+ messages in thread
From: Biju Das @ 2021-08-14 18:01 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai
Cc: Biju Das, Liam Girdwood, Mark Brown, Lad Prabhakar, alsa-devel,
Geert Uytterhoeven, Chris Paterson, Biju Das, linux-renesas-soc
The pointer returned by the dma_request_chan function is an error pointer
for the error cases. But on the rz_ssi_dma_request function, it checks for
NULL pointer instead.
This patch fixes the issue by checking the error pointer instead of NULL
pointer.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v1->v2:
* Replaced IS_ERR_OR_NULL with IS_ERR for error pointer check, as the
dma_request_chan function never returns NULL pointer for error case.
---
sound/soc/sh/rz-ssi.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index ea8d33ede5d2..2f9345415a15 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -676,11 +676,19 @@ static void rz_ssi_release_dma_channels(struct rz_ssi_priv *ssi)
static int rz_ssi_dma_request(struct rz_ssi_priv *ssi, struct device *dev)
{
ssi->playback.dma_ch = dma_request_chan(dev, "tx");
+ if (IS_ERR(ssi->playback.dma_ch))
+ ssi->playback.dma_ch = NULL;
+
ssi->capture.dma_ch = dma_request_chan(dev, "rx");
+ if (IS_ERR(ssi->capture.dma_ch))
+ ssi->capture.dma_ch = NULL;
+
if (!ssi->playback.dma_ch && !ssi->capture.dma_ch) {
ssi->playback.dma_ch = dma_request_chan(dev, "rt");
- if (!ssi->playback.dma_ch)
+ if (IS_ERR(ssi->playback.dma_ch)) {
+ ssi->playback.dma_ch = NULL;
goto no_dma;
+ }
ssi->dma_rt = true;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH v2] ASoC: sh: rz-ssi: Improve error handling in rz_ssi_dma_request function
@ 2021-08-14 18:01 ` Biju Das
0 siblings, 0 replies; 2+ messages in thread
From: Biju Das @ 2021-08-14 18:01 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai
Cc: alsa-devel, Geert Uytterhoeven, Liam Girdwood, Lad Prabhakar,
linux-renesas-soc, Mark Brown, Chris Paterson, Biju Das,
Biju Das
The pointer returned by the dma_request_chan function is an error pointer
for the error cases. But on the rz_ssi_dma_request function, it checks for
NULL pointer instead.
This patch fixes the issue by checking the error pointer instead of NULL
pointer.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v1->v2:
* Replaced IS_ERR_OR_NULL with IS_ERR for error pointer check, as the
dma_request_chan function never returns NULL pointer for error case.
---
sound/soc/sh/rz-ssi.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index ea8d33ede5d2..2f9345415a15 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -676,11 +676,19 @@ static void rz_ssi_release_dma_channels(struct rz_ssi_priv *ssi)
static int rz_ssi_dma_request(struct rz_ssi_priv *ssi, struct device *dev)
{
ssi->playback.dma_ch = dma_request_chan(dev, "tx");
+ if (IS_ERR(ssi->playback.dma_ch))
+ ssi->playback.dma_ch = NULL;
+
ssi->capture.dma_ch = dma_request_chan(dev, "rx");
+ if (IS_ERR(ssi->capture.dma_ch))
+ ssi->capture.dma_ch = NULL;
+
if (!ssi->playback.dma_ch && !ssi->capture.dma_ch) {
ssi->playback.dma_ch = dma_request_chan(dev, "rt");
- if (!ssi->playback.dma_ch)
+ if (IS_ERR(ssi->playback.dma_ch)) {
+ ssi->playback.dma_ch = NULL;
goto no_dma;
+ }
ssi->dma_rt = true;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-14 18:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-14 18:01 [PATCH v2] ASoC: sh: rz-ssi: Improve error handling in rz_ssi_dma_request function Biju Das
2021-08-14 18:01 ` Biju Das
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.