lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZBSukvE/EEH5UsTQ@nimitz>
Date:   Fri, 17 Mar 2023 19:16:50 +0100
From:   Piotr Raczynski <piotr.raczynski@...el.com>
To:     Sebastian Reichel <sebastian.reichel@...labora.com>
CC:     Giuseppe Cavallaro <peppe.cavallaro@...com>,
        Alexandre Torgue <alexandre.torgue@...s.st.com>,
        Jose Abreu <joabreu@...opsys.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        "Jakub Kicinski" <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <kernel@...labora.com>
Subject: Re: [PATCHv1 2/2] net: ethernet: stmmac: dwmac-rk: fix optional phy
 regulator handling

On Fri, Mar 17, 2023 at 06:42:43PM +0100, Sebastian Reichel wrote:
> The usual devm_regulator_get() call already handles "optional"
> regulators by returning a valid dummy and printing a warning
> that the dummy regulator should be described properly. This
> code open coded the same behaviour, but masked any errors that
> are not -EPROBE_DEFER and is quite noisy.
> 
> This change effectively unmasks and propagates regulators errors
> not involving -ENODEV, downgrades the error print to warning level
> if no regulator is specified and captures the probe defer message
> for /sys/kernel/debug/devices_deferred.

Code looks fine, however this seems like a fix, then Fixes tag would
be nice. Also target tree (net?) should be specified.

> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@...labora.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> index 126812cd17e6..01de0174fa18 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> @@ -1680,14 +1680,11 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,
>  		}
>  	}
>  
> -	bsp_priv->regulator = devm_regulator_get_optional(dev, "phy");
> +	bsp_priv->regulator = devm_regulator_get(dev, "phy");
>  	if (IS_ERR(bsp_priv->regulator)) {
> -		if (PTR_ERR(bsp_priv->regulator) == -EPROBE_DEFER) {
> -			dev_err(dev, "phy regulator is not available yet, deferred probing\n");
> -			return ERR_PTR(-EPROBE_DEFER);
> -		}
> -		dev_err(dev, "no regulator found\n");
> -		bsp_priv->regulator = NULL;
> +		ret = PTR_ERR(bsp_priv->regulator);
> +		dev_err_probe(dev, ret, "failed to get phy regulator\n");
> +		return ERR_PTR(ret);
>  	}
>  
>  	ret = of_property_read_string(dev->of_node, "clock_in_out", &strings);
> -- 
> 2.39.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ