[PATCH 2/2] PCI: armada8k: Fix clock resource by adding a register clock

Russell King - ARM Linux linux at armlinux.org.uk
Wed Feb 28 07:27:57 PST 2018


On Wed, Feb 28, 2018 at 03:47:04PM +0100, Gregory CLEMENT wrote:
> @@ -229,6 +230,15 @@ static int armada8k_pcie_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  
> +	if (IS_ERR(pcie->clk_reg) && PTR_ERR(pcie->clk_reg) == -EPROBE_DEFER) {

You do realise this is needlessly complex.

Pointer errors are unique, so:

	if (pcie->clk_reg == ERR_PTR(-EPROBE_DEFER)) {

will do the same thing but without the complexity.  Transforming the
constant rather than the variable is also a good habbit to get into -
the compiler can optimise transforms to constants, but can't with
variables, so comparisons involving things like endian conversion
should always be done by transforming the constant not the variable.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up



More information about the linux-arm-kernel mailing list