Re: [PATCH 1/1] USB: PHY: JZ4770: Fix static checker warning.

From: Andy Shevchenko
Date: Tue Jul 28 2020 - 13:26:28 EST


On Tue, Jul 28, 2020 at 8:09 PM åçæ (Zhou Yanjie)
<zhouyanjie@xxxxxxxxxxxxxx> wrote:
>
> The commit 2a6c0b82e651 ("USB: PHY: JZ4770: Add support for new
> Ingenic SoCs.") introduced the initialization function for different
> chips, but left the relevant code involved in the resetting process
> in the original function, resulting in uninitialized variable calls.
> This problem can be solved by putting this part of the code into the
> initialization function for each chip. Although the four processors
> currently supported have the same reset code, let us can solve this

'can' -> ''

> problem by adding the initialization of the reg variable to the
> original function, but when other processors with different reset
> methods (such as X2000) are introduced in the future, it will cause
> inevitable condition judgments to complicate the function, which
> violates the original intention of introducing initialization
> functions for each processor.
>
> Fixes: 2a6c0b82e651 ("USB: PHY: JZ4770: Add support for new
> Ingenic SoCs.").

No period at the end

>

No blank line in the tag block.

> Reported-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Signed-off-by: åçæ (Zhou Yanjie) <zhouyanjie@xxxxxxxxxxxxxx>

...

> + /* Wait for PHY to reset */
> + usleep_range(30, 300);
> + writel(reg & ~USBPCR_POR, priv->base + REG_USBPCR_OFFSET);
> + usleep_range(300, 1000);

Instead of copy'n'paste 4 times, you may provide a helper function.

--
With Best Regards,
Andy Shevchenko