diff mbox series

[v2,1/1] ASoC: imx-audmux: fix return value checks of clk_prepare_enable()

Message ID 20230722123635.26623-1-ruc_gongyuanjun@163.com (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series [v2,1/1] ASoC: imx-audmux: fix return value checks of clk_prepare_enable() | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.
snowpatch_ozlabs/github-powerpc_clang success Successfully ran 6 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu success Successfully ran 23 jobs.

Commit Message

Yuanjun Gong July 22, 2023, 12:36 p.m. UTC
check the return value of clk_prepare_enable(), and if
clk_prepare_enable() gets an unexpected return value,
imx_audmux_suspend() and imx_audmux_resume() should return
the error value.

Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
---
 sound/soc/fsl/imx-audmux.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Fabio Estevam July 22, 2023, 12:40 p.m. UTC | #1
On Sat, Jul 22, 2023 at 9:38 AM Yuanjun Gong <ruc_gongyuanjun@163.com> wrote:
>
> check the return value of clk_prepare_enable(), and if
> clk_prepare_enable() gets an unexpected return value,
> imx_audmux_suspend() and imx_audmux_resume() should return
> the error value.
>
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
> ---
>  sound/soc/fsl/imx-audmux.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
> index be003a117b39..9791e56158ef 100644
> --- a/sound/soc/fsl/imx-audmux.c
> +++ b/sound/soc/fsl/imx-audmux.c
> @@ -325,8 +325,11 @@ static void imx_audmux_remove(struct platform_device *pdev)
>  static int imx_audmux_suspend(struct device *dev)
>  {
>         int i;
> +       ssize_t ret;

Why not simply "int ret" instead?
Shengjiu Wang July 28, 2023, 4:29 a.m. UTC | #2
On Sat, Jul 22, 2023 at 8:38 PM Yuanjun Gong <ruc_gongyuanjun@163.com>
wrote:

> check the return value of clk_prepare_enable(), and if
> clk_prepare_enable() gets an unexpected return value,
> imx_audmux_suspend() and imx_audmux_resume() should return
> the error value.
>
>
please use the ./scripts/get_maintainer.pl to get the maillist
and resend the patch.

best regards
wang shengjiu


> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
> ---
>  sound/soc/fsl/imx-audmux.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
> index be003a117b39..9791e56158ef 100644
> --- a/sound/soc/fsl/imx-audmux.c
> +++ b/sound/soc/fsl/imx-audmux.c
> @@ -325,8 +325,11 @@ static void imx_audmux_remove(struct platform_device
> *pdev)
>  static int imx_audmux_suspend(struct device *dev)
>  {
>         int i;
> +       ssize_t ret;
>
> -       clk_prepare_enable(audmux_clk);
> +       ret = clk_prepare_enable(audmux_clk);
> +       if (ret)
> +               return ret;
>
>         for (i = 0; i < reg_max; i++)
>                 regcache[i] = readl(audmux_base + i * 4);
> @@ -339,8 +342,11 @@ static int imx_audmux_suspend(struct device *dev)
>  static int imx_audmux_resume(struct device *dev)
>  {
>         int i;
> +       ssize_t ret;
>
> -       clk_prepare_enable(audmux_clk);
> +       ret = clk_prepare_enable(audmux_clk);
> +       if (ret)
> +               return ret;
>
>         for (i = 0; i < reg_max; i++)
>                 writel(regcache[i], audmux_base + i * 4);
> --
> 2.17.1
>
>
diff mbox series

Patch

diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index be003a117b39..9791e56158ef 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -325,8 +325,11 @@  static void imx_audmux_remove(struct platform_device *pdev)
 static int imx_audmux_suspend(struct device *dev)
 {
 	int i;
+	ssize_t ret;
 
-	clk_prepare_enable(audmux_clk);
+	ret = clk_prepare_enable(audmux_clk);
+	if (ret)
+		return ret;
 
 	for (i = 0; i < reg_max; i++)
 		regcache[i] = readl(audmux_base + i * 4);
@@ -339,8 +342,11 @@  static int imx_audmux_suspend(struct device *dev)
 static int imx_audmux_resume(struct device *dev)
 {
 	int i;
+	ssize_t ret;
 
-	clk_prepare_enable(audmux_clk);
+	ret = clk_prepare_enable(audmux_clk);
+	if (ret)
+		return ret;
 
 	for (i = 0; i < reg_max; i++)
 		writel(regcache[i], audmux_base + i * 4);