diff mbox series

asoc: mediatek: common: Remove check of return value of mtk_memif_set_addr() and mtk_memif_set_format()

Message ID 20230825153650.20923-1-adiupina@astralinux.ru
State New
Headers show
Series asoc: mediatek: common: Remove check of return value of mtk_memif_set_addr() and mtk_memif_set_format() | expand

Commit Message

Alexandra Diupina Aug. 25, 2023, 3:36 p.m. UTC
The mtk_memif_set_addr() and mtk_memif_set_format() functions always returns 0, so it is
necessary to remove the check of its return value (which was
probably specified by analogy with the check of return values
for other functions) to make the code more readable

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: df799b9502ed ("ASoC: mediatek: common: refine hw_params and hw_prepare")
Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru>
---
 sound/soc/mediatek/common/mtk-afe-fe-dai.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

Comments

Mark Brown Sept. 18, 2023, 1:31 p.m. UTC | #1
On Fri, Aug 25, 2023 at 06:36:50PM +0300, Alexandra Diupina wrote:
> The mtk_memif_set_addr() and mtk_memif_set_format() functions always returns 0, so it is
> necessary to remove the check of its return value (which was
> probably specified by analogy with the check of return values
> for other functions) to make the code more readable

If the return values can be safely ignored the functions should be
updated to return void, if the functions are returning a value it is
sensible defensive programming to check it.

> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: df799b9502ed ("ASoC: mediatek: common: refine hw_params and hw_prepare")

This is in no way a bug fix, please don't include noise like this - it
causes people to waste time doing things like considering it for backport.

Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.
diff mbox series

Patch

diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c
index 882cdf86c8bf..3c8a11c5958d 100644
--- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c
+++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c
@@ -143,15 +143,10 @@  int mtk_afe_fe_hw_params(struct snd_pcm_substream *substream,
 		  substream->runtime->dma_bytes);
 
 	/* set addr */
-	ret = mtk_memif_set_addr(afe, id,
+	mtk_memif_set_addr(afe, id,
 				 substream->runtime->dma_area,
 				 substream->runtime->dma_addr,
 				 substream->runtime->dma_bytes);
-	if (ret) {
-		dev_err(afe->dev, "%s(), error, id %d, set addr, ret %d\n",
-			__func__, id, ret);
-		return ret;
-	}
 
 	/* set channel */
 	ret = mtk_memif_set_channel(afe, id, channels);
@@ -170,12 +165,7 @@  int mtk_afe_fe_hw_params(struct snd_pcm_substream *substream,
 	}
 
 	/* set format */
-	ret = mtk_memif_set_format(afe, id, format);
-	if (ret) {
-		dev_err(afe->dev, "%s(), error, id %d, set format %d, ret %d\n",
-			__func__, id, format, ret);
-		return ret;
-	}
+	mtk_memif_set_format(afe, id, format);
 
 	return 0;
 }