[PATCH net-next v4 5/8] net: mdio: mux-mmioreg: Simplified with dev_err_probe()

Andrew Lunn andrew at lunn.ch
Tue Sep 3 05:53:23 PDT 2024


> > @@ -109,30 +109,25 @@ static int mdio_mux_mmioreg_probe(struct platform_device *pdev)
> >   		return -ENOMEM;
> >   	ret = of_address_to_resource(np, 0, &res);
> > -	if (ret) {
> > -		dev_err(&pdev->dev, "could not obtain memory map for node %pOF\n",
> > -			np);
> > -		return ret;
> > -	}
> > +	if (ret)
> > +		return dev_err_probe(&pdev->dev, ret,
> > +				     "could not obtain memory map for node %pOF\n", np);
> 
> Besides that one, which I don't think is even a candidate for resource
> deferral in the first place given the OF platform implementation, it does
> not seem to help that much to switch to dev_err_probe() other than just
> combining the error message and return code in a single statement. So it's
> fewer lines of codes, but it is not exactly what dev_err_probe() was
> originally intended for IMHO.

Agreed. Rather than abuse dev_err_probe(), maybe a dev_err_error()
would be added with the same prototype, does the same formatting, and
skips all the PROBE_DEFFER logic. The problem would be, it would
encourage more of this churn.

	Andrew



More information about the linux-arm-kernel mailing list