Re: [PATCH net-next v5 3/3] net: ethernet: ti: am65-cpsw: Add support for SERDES configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hello,

On Wed, 2022-11-09 at 09:52 +0530, Siddharth Vadapalli wrote:
[...]

> +static void am65_cpsw_disable_serdes_phy(struct am65_cpsw_common *common)
> +{
> +	struct device_node *node, *port_np;
> +	struct device *dev = common->dev;
> +	const char *name = "serdes-phy";
> +	struct phy *phy;
> +
> +	node = of_get_child_by_name(dev->of_node, "ethernet-ports");
> +
> +	for_each_child_of_node(node, port_np) {
> +		phy = devm_of_phy_get(dev, port_np, name);

The above will try to allocate some memory and can fail. Even if the
the following code will handle a NULL ptr, the phy will not be
disabled.

I think it's better if you cache the serdes phy ptr in
am65_cpsw_init_serdes_phy() and you use such reference here, without
resorting to devm_of_phy_get().

Cheers,

Paolo




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux