* [PATCH] rtc: max77686: add missing variable initialization
@ 2013-02-15 7:45 Jingoo Han
2013-02-15 23:14 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Jingoo Han @ 2013-02-15 7:45 UTC (permalink / raw)
To: 'Andrew Morton'
Cc: linux-kernel, 'Alessandro Zummo',
rtc-linux, 'Jingoo Han'
Fixed build warning as below:
drivers/rtc/rtc-max77686.c: In function 'max77686_rtc_update':
drivers/rtc/rtc-max77686.c:147:6: warning: 'data' may be used uninitialized in this function [-Wuninitialized]
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/rtc/rtc-max77686.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index abe27c0..2634fed 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -133,7 +133,7 @@ static int max77686_rtc_update(struct max77686_rtc_info *info,
enum MAX77686_RTC_OP op)
{
int ret;
- unsigned int data;
+ unsigned int data = 0;
switch (op) {
case MAX77686_RTC_WRITE:
--
1.7.2.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rtc: max77686: add missing variable initialization
2013-02-15 7:45 [PATCH] rtc: max77686: add missing variable initialization Jingoo Han
@ 2013-02-15 23:14 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2013-02-15 23:14 UTC (permalink / raw)
To: Jingoo Han; +Cc: linux-kernel, 'Alessandro Zummo', rtc-linux
On Fri, 15 Feb 2013 16:45:38 +0900
Jingoo Han <jg1.han@samsung.com> wrote:
> Fixed build warning as below:
>
> drivers/rtc/rtc-max77686.c: In function 'max77686_rtc_update':
> drivers/rtc/rtc-max77686.c:147:6: warning: 'data' may be used uninitialized in this function [-Wuninitialized]
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
> drivers/rtc/rtc-max77686.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
> index abe27c0..2634fed 100644
> --- a/drivers/rtc/rtc-max77686.c
> +++ b/drivers/rtc/rtc-max77686.c
> @@ -133,7 +133,7 @@ static int max77686_rtc_update(struct max77686_rtc_info *info,
> enum MAX77686_RTC_OP op)
> {
> int ret;
> - unsigned int data;
> + unsigned int data = 0;
>
> switch (op) {
> case MAX77686_RTC_WRITE:
spose so. But the end result is rather awkward-looking.
As `op' must be (and is) one of MAX77686_RTC_WRITE and
MAX77686_RTC_READ, the straightfoward implementation is
static int max77686_rtc_update(struct max77686_rtc_info *info,
enum MAX77686_RTC_OP op)
{
int ret;
unsigned int data;
if (op == MAX77686_RTC_WRITE)
data = 1 << RTC_UDR_SHIFT;
else
data = 1 << RTC_RBUDR_SHIFT;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-15 23:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-15 7:45 [PATCH] rtc: max77686: add missing variable initialization Jingoo Han
2013-02-15 23:14 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).