[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5016BF03.70805@codeaurora.org>
Date: Mon, 30 Jul 2012 10:06:11 -0700
From: Stephen Boyd <sboyd@...eaurora.org>
To: Venu Byravarasu <vbyravarasu@...dia.com>
CC: "a.zummo@...ertech.it" <a.zummo@...ertech.it>,
"sameo@...ux.intel.com" <sameo@...ux.intel.com>,
"broonie@...nsource.wolfsonmicro.com"
<broonie@...nsource.wolfsonmicro.com>,
Laxman Dewangan <ldewangan@...dia.com>,
"kyle.manna@...l7.com" <kyle.manna@...l7.com>,
"rtc-linux@...glegroups.com" <rtc-linux@...glegroups.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [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.
--
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