Re: [PATCH] ATA: SATA_MV: Fix probe failure when no phy exists

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

 



On Fri, Jan 31, 2014 at 06:04:22AM -0500, Tejun Heo wrote:
> On Fri, Jan 31, 2014 at 11:54:11AM +0100, Andrew Lunn wrote:
> > EPROBE_DEFER: We need to fail the probe, but it is not fatal.
> > ENOSYS: No generic PHY framework, sata_mv can load.
> > ENODEV: No phy, probably because it is optional and not there, sata_mv can load.
> > ENOMEM, EINVAL, etc are real errors and should probably be fatal and
> > returned by the probe function.
> > 
> > So i could reverse the comparison, look for ENOSYS and ENODEV and
> > allow the probe to succeed and return the error in all other cases.
> 
> Or add a helper, e.g. is_phy_error_fatal(), so that the knowledge
> about specific error codes don't end up getting spread through the
> code base?

Hi Tejun

The problem here is there is a different between optional and non
optional phys. If it is not optional, ENODEV is fatal. If it is
optional ENODEV is not fatal. So it needs at least to be

bool is_phy_error_fatal(struct phy *phy, bool optional)

Also, EPROBE_DEFER is not fatal, but still needs the probe to return
an error code. So the code ends up something like

	phy = devm_phy_get(...);
   	if (IS_ERR(phy) {
      		if (is_phy_error_fatal(phy, true)) {
			dev_err(dev, "Fatal phy error);
	 		goto out;
      		}
		if (PTR_ERR(phy) == -EPROBE_DEFER)
			goto out;
	}

I can implement this if you want.

  Andrew
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux