Re: [PATCH V3 net-next 5/6] net: mdio: of: Register discovered MII time stampers.

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

 



> +struct mii_timestamper *of_find_mii_timestamper(struct device_node *node)
> +{
> +	struct of_phandle_args arg;
> +	int err;
> +
> +	err = of_parse_phandle_with_fixed_args(node, "timestamper", 1, 0, &arg);
> +
> +	if (err == -ENOENT)
> +		return NULL;
> +	else if (err)
> +		return ERR_PTR(err);
> +
> +	if (arg.args_count != 1)
> +		return ERR_PTR(-EINVAL);
> +
> +	return register_mii_timestamper(arg.np, arg.args[0]);
> +}
> +
>  static int of_mdiobus_register_phy(struct mii_bus *mdio,
>  				    struct device_node *child, u32 addr)
>  {
> +	struct mii_timestamper *mii_ts;
>  	struct phy_device *phy;
>  	bool is_c45;
>  	int rc;
>  	u32 phy_id;
>  
> +	mii_ts = of_find_mii_timestamper(child);
> +	if (IS_ERR(mii_ts))
> +		return PTR_ERR(mii_ts);
> +
>  	is_c45 = of_device_is_compatible(child,
>  					 "ethernet-phy-ieee802.3-c45");
>  

Hi Richard

There can be errors after this, e.g. of_irq_get() returns
-EPROBE_DEFER, or from phy_device_register().

Shouldn't unregister_mii_timestamper() be called on error?

	  Andrew



[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