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

Gregory CLEMENT gregory.clement at bootlin.com
Wed Feb 28 07:31:16 PST 2018


Hi Russell King,
 
 On mer., févr. 28 2018, Russell King - ARM Linux <linux at armlinux.org.uk> wrote:

> 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.

Thanks for the tip, I will use it in the next version.

Gregory

>
> -- 
> 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

-- 
Gregory Clement, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com



More information about the linux-arm-kernel mailing list