rtc: max77686: add missing variable initialization
PATCH 1/1 rtc: max77686: add missing variable initialization
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]
--- drivers/rtc/rtc-max77686.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/rtc/rtc-max77686.c +1 -1
@@ -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 :
Signature · 1 line
1.7.2.5
Quoted 15 lines · On Fri, 15 Feb 2013 16:45:38 +0900 Jingoo Han <[email protected]> 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 <[email protected]>--- drivers/rtc/rtc-max77686.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/rtc/rtc-max77686.c +0
-0
drivers/rtc/rtc-max77686.c static int max77686_rtc_update(struct max77686_rtc_info *info, · line 139
Quoted 8 lines
drivers/rtc/rtc-max77686.c +1
-1@@ -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;