[lkml]   [2012]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] rtc: tps65910: Add RTC driver for TPS65910 PMIC RTC
On 07/30/12 03:07, Venu Byravarasu wrote:
> +
> +static int __devinit tps65910_rtc_probe(struct platform_device *pdev)
> +{
> + struct tps65910 *tps65910 = NULL;
> + struct tps65910_rtc *tps_rtc = NULL;
> + struct tps65910_board *pmic_plat_data;
> + int ret = -EINVAL;
> + int irq = 0;
> + u32 rtc_reg;
>> It seems like all the above assignments are useless as they're
>> overwritten later in this function. Can you remove the assignments?
> Some of the non-intelligent compilers/tools complain as variables
> may get used uninitialized. Hence to avoid such complaints, initialized
> them to some default values.
> What harm do you see if I have local variables initialized during their declaration?

If you return early from a function and forget to give a variable a
value you actually want, you may use it pre-initialized with a bad
value. I would be surprised if a compiler complained about these ones
because they are simple assignments and they aren't under conditional
paths. If there is still a problem, you can use the uninitialized_var()
macro but I don't see why you would need to.

Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

 \ /
  Last update: 2012-07-30 19:41    [W:0.036 / U:31.508 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site