回覆: [PATCH net-next v4 3/7] net: ftgmac100: Add reset toggling for Aspeed SOCs
From: Jacky Chou
Date: Tue Dec 10 2024 - 22:06:59 EST
Hi Smatch
Thank you for your reply.
> > + struct reset_control *rst;
> >
> > /* AST2500/AST2600 RMII ref clock gate */
> > struct clk *rclk;
> > @@ -1979,6 +1981,22 @@ static int ftgmac100_probe(struct
> platform_device *pdev)
> > priv->base + FTGMAC100_OFFSET_TM);
> > }
> >
> > + priv->rst = devm_reset_control_get_optional_exclusive(priv->dev, NULL);
> > + if (IS_ERR(priv->rst))
> > + goto err_register_netdev;
>
> Hi Jacky,
>
> The goto on the line above will result in this function returning err.
> However, it seems that err is set to 0 here.
> And perhaps it should be set to PTR_ERR(priv->rst).
>
> Flagged by Smatch.
Agree.
I will add that err is assigned by PTR_ERR(priv->rst) for error handling in next version.
priv->rst = devm_reset_control_get_optional_exclusive(priv->dev, NULL);
if (IS_ERR(priv->rst)) {
err = PTR_ERR(priv->rst);
goto err_register_netdev;
}
Otherwise, err may be zero when getting an error from devm_reset_control_get_Optional_exclusive().
Thank you for your kind reminder.
Thanks,
Jacky