lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4FD91D99.8050706@linaro.org>
Date:	Wed, 13 Jun 2012 16:09:13 -0700
From:	John Stultz <john.stultz@...aro.org>
To:	Paul Mundt <lethal@...ux-sh.org>
CC:	LKML <linux-kernel@...r.kernel.org>,
	Arve Hj??nnev??g <arve@...roid.com>,
	Russell King <linux@....linux.org.uk>,
	Paul Gortmaker <paul.gortmaker@...driver.com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Mathieu Poirier <mathieu.poirier@...aro.org>
Subject: Re: [PATCH 01/15] ARM: etm: Don't require clock control

On 06/13/2012 01:33 AM, Paul Mundt wrote:
> On Tue, Jun 12, 2012 at 07:01:19PM -0700, John Stultz wrote:
>> diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c
>> index 36d20bd..bd295e8 100644
>> --- a/arch/arm/kernel/etm.c
>> +++ b/arch/arm/kernel/etm.c
>> @@ -362,13 +362,12 @@ static int __devinit etb_probe(struct amba_device *dev, const struct amba_id *id
>>   	if (ret)
>>   		goto out_unmap;
>>
>> +	/* Get optional clock. Currently used to select clock source on omap3 */
>>   	t->emu_clk = clk_get(&dev->dev, "emu_src_ck");
>> -	if (IS_ERR(t->emu_clk)) {
>> +	if (IS_ERR(t->emu_clk))
>>   		dev_dbg(&dev->dev, "Failed to obtain emu_src_ck.\n");
>> -		return -EFAULT;
>> -	}
>> -
>> -	clk_enable(t->emu_clk);
>> +	else
>> +		clk_enable(t->emu_clk);
>>
> Optionally you could just:
>
> 	if (IS_ERR(t->emu_clk))
> 		t->emu_clk = NULL;
>
> and use the clk API as you were, as it does handle NULL being passed in.
>
> In this case you don't have too many callsites to worry about, but it's
> reasonably convenient to be able to pass a NULL clk pointer around
> without constant special-casing when those start to balloon up.
>
Hrm. That's a good trick to remember for the future!

Although in this case I'm not sure it wins much (since the re-adding of 
the braces and the null assignment is still more code then using the 
else).  So unless this is a major style problem for you (and do let me 
know if it is), I'll probably leave it alone.

thanks
-john

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ