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:
 <TY3PR01MB11346021C2523D745BFE6005486D82@TY3PR01MB11346.jpnprd01.prod.outlook.com>
Date: Thu, 20 Mar 2025 15:26:47 +0000
From: Biju Das <biju.das.jz@...renesas.com>
To: Geert Uytterhoeven <geert+renesas@...der.be>, Rob Herring
	<robh@...nel.org>, Marc Kleine-Budde <mkl@...gutronix.de>, Vincent Mailhol
	<mailhol.vincent@...adoo.fr>, Vinod Koul <vkoul@...nel.org>, Kishon Vijay
 Abraham I <kishon@...nel.org>, Peter Rosin <peda@...ntia.se>, Aswath
 Govindraju <a-govindraju@...com>
CC: "linux-can@...r.kernel.org" <linux-can@...r.kernel.org>,
	"linux-phy@...ts.infradead.org" <linux-phy@...ts.infradead.org>,
	"linux-renesas-soc@...r.kernel.org" <linux-renesas-soc@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2] phy: can-transceiver: Re-instate "mux-states" property
 presence check

Hi Geert,

> -----Original Message-----
> From: Geert Uytterhoeven <geert+renesas@...der.be>
> Sent: 20 March 2025 15:16
> Subject: [PATCH v2] phy: can-transceiver: Re-instate "mux-states" property presence check
> 
> On the Renesas Gray Hawk Single development board:
> 
>     can-transceiver-phy can-phy0: /can-phy0: failed to get mux-state (0)
> 
> "mux-states" is an optional property for CAN transceivers.  However,
> mux_get() always prints an error message in case of an error, including when the property is not
> present, confusing the user.
> 
> Fix this by re-instating the property presence check (this time using the proper API) in a wrapper
> around devm_mux_state_get().  When the multiplexer subsystem gains support for optional muxes, the
> wrapper can just be removed.
> 
> In addition, propagate all real errors upstream, instead of ignoring them.
> 
> Fixes: d02dfd4ceb2e9f34 ("phy: can-transceiver: Drop unnecessary "mux-states" property presence
> check")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>

Tested-by: Biju Das <biju.das.jz@...renesas.com>
Reviewed-by: Biju Das <biju.das.jz@...renesas.com>

Tested on RZ/G3E SMARC EVK that has tcan1046v-q1 that is modelled as two instances of tcan1042.

Cheers,
Biju

> ---
> Alternatively, the multiplexer subsystem needs to gain support for getting an optional mux...
> 
> v2:
>   - Add and use devm_mux_state_get_optional(),
>   - No given tags added, as the new solution is different.
> ---
>  drivers/phy/phy-can-transceiver.c | 22 +++++++++++++++-------
>  1 file changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transceiver.c
> index 2bec70615449f94d..f59caff4b3d4c267 100644
> --- a/drivers/phy/phy-can-transceiver.c
> +++ b/drivers/phy/phy-can-transceiver.c
> @@ -93,6 +93,16 @@ static const struct of_device_id can_transceiver_phy_ids[] = {  };
> MODULE_DEVICE_TABLE(of, can_transceiver_phy_ids);
> 
> +/* Temporary wrapper until the multiplexer subsystem supports optional
> +muxes */ static inline struct mux_state *
> +devm_mux_state_get_optional(struct device *dev, const char *mux_name) {
> +	if (!of_property_present(dev->of_node, "mux-states"))
> +		return NULL;
> +
> +	return devm_mux_state_get(dev, mux_name); }
> +
>  static int can_transceiver_phy_probe(struct platform_device *pdev)  {
>  	struct phy_provider *phy_provider;
> @@ -114,13 +124,11 @@ static int can_transceiver_phy_probe(struct platform_device *pdev)
>  	match = of_match_node(can_transceiver_phy_ids, pdev->dev.of_node);
>  	drvdata = match->data;
> 
> -	mux_state = devm_mux_state_get(dev, NULL);
> -	if (IS_ERR(mux_state)) {
> -		if (PTR_ERR(mux_state) == -EPROBE_DEFER)
> -			return PTR_ERR(mux_state);
> -	} else {
> -		can_transceiver_phy->mux_state = mux_state;
> -	}
> +	mux_state = devm_mux_state_get_optional(dev, NULL);
> +	if (IS_ERR(mux_state))
> +		return PTR_ERR(mux_state);
> +
> +	can_transceiver_phy->mux_state = mux_state;
> 
>  	phy = devm_phy_create(dev, dev->of_node,
>  			      &can_transceiver_phy_ops);
> --
> 2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ