[PATCH] PCI: imx6: Fix wrong check in imx6_pcie_attach_pd()

Russell King (Oracle) linux at armlinux.org.uk
Tue Sep 13 00:46:06 PDT 2022


On Tue, Sep 13, 2022 at 09:39:03AM +0200, Lucas Stach wrote:
> Am Dienstag, dem 13.09.2022 um 14:59 +0800 schrieb Tang Bin:
> > In the function imx6_pcie_attach_pd(),
> > dev_pm_domain_attach_by_name() may return NULL in some cases,
> > so IS_ERR() doesn't meet the requirements. Thus fix it.
> > 
> I don't like this added complexity in the driver. IHMO if there is a
> real issue, dev_pm_domain_attach_by_name() should just return a error
> code, instead of NULL.

You've fallen into the trap that Tang Bin laid. It returns an error
code for all cases where an error has happened. It returns NULL only
when the device does not require a power domain. So, a NULL return is
*not* an error condition, but merely an indication that "this device
does not require this power domain".

Mechanical changes like this are really quite harmful to the kernel.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!



More information about the linux-arm-kernel mailing list