On Sat, Jul 06, 2019 at 05:18:59PM +0200, [email protected] wrote:
> From: Josua Mayer <[email protected]>
>
> Print a warning when device tree specifies more than the maximum of four
> clocks supported by orion-mdio. Because reading from mdio can lock up
> the Armada 8k when a required clock is not initialized, it is important
> to notify the user when a specified clock is ignored.
>
> Signed-off-by: Josua Mayer <[email protected]>
> ---
> drivers/net/ethernet/marvell/mvmdio.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/ethernet/marvell/mvmdio.c
> b/drivers/net/ethernet/marvell/mvmdio.c
> index e17d563e97a6..89a99bf8e87b 100644
> --- a/drivers/net/ethernet/marvell/mvmdio.c
> +++ b/drivers/net/ethernet/marvell/mvmdio.c
> @@ -326,6 +326,10 @@ static int orion_mdio_probe(struct platform_device *pdev)
> clk_prepare_enable(dev->clk[i]);
> }
>
> + if (!IS_ERR(of_clk_get(pdev->dev.of_node, i)))
> + dev_warn(dev, "unsupported number of clocks, limiting to the
> first "
> + __stringify(ARRAY_SIZE(dev->clk)) "\n");
> +
Hi Josua
Humm. Say getting clock 0 returned -EINVAL, or some other error code.
We break out of the loop, since such errors are being ignored. We then
hit this new code. Getting clock 1 works, and then we incorrectly
print this message.
Rather than getting the i'th clock, get ARRAY_SIZE(dev->clk)'th clock.
Andrew