lkml.org 
[lkml]   [2020]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] net: mdio: Remove redundant parameter and check
From
Date
On 23.09.2020 12:05, Tang Bin wrote:
> In the function ipq8064_mdio_probe(), of_mdiobus_register() might
> returned zero, so the direct return can simplify code. Thus remove
> redundant parameter and check.
>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> ---
> drivers/net/mdio/mdio-ipq8064.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/mdio/mdio-ipq8064.c b/drivers/net/mdio/mdio-ipq8064.c
> index 1bd1885..33cccce 100644
> --- a/drivers/net/mdio/mdio-ipq8064.c
> +++ b/drivers/net/mdio/mdio-ipq8064.c
> @@ -102,7 +102,6 @@ ipq8064_mdio_probe(struct platform_device *pdev)
> struct device_node *np = pdev->dev.of_node;
> struct ipq8064_mdio *priv;
> struct mii_bus *bus;
> - int ret;
>
> bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*priv));
> if (!bus)
> @@ -125,12 +124,9 @@ ipq8064_mdio_probe(struct platform_device *pdev)
> return PTR_ERR(priv->base);
> }
>
> - ret = of_mdiobus_register(bus, np);
> - if (ret)
> - return ret;
> -
> platform_set_drvdata(pdev, bus);

Before your patch this is called only after of_mdiobus_register()
returns successfully. Now it's called unconditionally before.
Are you sure this can't have a side effect?

> - return 0;
> +
> + return of_mdiobus_register(bus, np);
> }
>
> static int
>

\
 
 \ /
  Last update: 2020-09-23 12:11    [W:0.116 / U:0.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site