Re: [PATCH V2] ASoC: imx-audmux: remove unnecessary check of clk_disable_unprepare/clk_prepare_enable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 6, 2022 at 11:37 AM <cgel.zte@xxxxxxxxx> wrote:

> From: Minghao Chi <chi.minghao@xxxxxxxxxx>
>
> Because clk_disable_unprepare/clk_prepare_enable already checked NULL clock
> parameter, so the additional checks are unnecessary, just remove them.
>
> Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
> Signed-off-by: Minghao Chi <chi.minghao@xxxxxxxxxx>
>

Acked-by: Shengjiu Wang <shengjiu.wang@xxxxxxxxx>

Best regards
Wang Shengjiu

> ---
> v1->v2:
>         remove the check of audmux_clk before "clk_prepare_enable"
>  sound/soc/fsl/imx-audmux.c | 22 ++++++++--------------
>  1 file changed, 8 insertions(+), 14 deletions(-)
>
> diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
> index dfa05d40b276..3ba82adace42 100644
> --- a/sound/soc/fsl/imx-audmux.c
> +++ b/sound/soc/fsl/imx-audmux.c
> @@ -62,17 +62,14 @@ static ssize_t audmux_read_file(struct file *file,
> char __user *user_buf,
>         uintptr_t port = (uintptr_t)file->private_data;
>         u32 pdcr, ptcr;
>
> -       if (audmux_clk) {
> -               ret = clk_prepare_enable(audmux_clk);
> -               if (ret)
> -                       return ret;
> -       }
> +       ret = clk_prepare_enable(audmux_clk);
> +       if (ret)
> +               return ret;
>
>         ptcr = readl(audmux_base + IMX_AUDMUX_V2_PTCR(port));
>         pdcr = readl(audmux_base + IMX_AUDMUX_V2_PDCR(port));
>
> -       if (audmux_clk)
> -               clk_disable_unprepare(audmux_clk);
> +       clk_disable_unprepare(audmux_clk);
>
>         buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
>         if (!buf)
> @@ -209,17 +206,14 @@ int imx_audmux_v2_configure_port(unsigned int port,
> unsigned int ptcr,
>         if (!audmux_base)
>                 return -ENOSYS;
>
> -       if (audmux_clk) {
> -               ret = clk_prepare_enable(audmux_clk);
> -               if (ret)
> -                       return ret;
> -       }
> +       ret = clk_prepare_enable(audmux_clk);
> +       if (ret)
> +               return ret;
>
>         writel(ptcr, audmux_base + IMX_AUDMUX_V2_PTCR(port));
>         writel(pdcr, audmux_base + IMX_AUDMUX_V2_PDCR(port));
>
> -       if (audmux_clk)
> -               clk_disable_unprepare(audmux_clk);
> +       clk_disable_unprepare(audmux_clk);
>
>         return 0;
>  }
> --
> 2.25.1
>
>
>



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux