linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Jingoo Han <jg1.han@samsung.com>
Cc: linux-kernel@vger.kernel.org,
	"'Alessandro Zummo'" <a.zummo@towertech.it>,
	rtc-linux@googlegroups.com
Subject: Re: [PATCH] rtc: max77686: add missing variable initialization
Date: Fri, 15 Feb 2013 15:14:30 -0800	[thread overview]
Message-ID: <20130215151430.0cf4bfb2.akpm@linux-foundation.org> (raw)
In-Reply-To: <003601ce0b50$726cb860$57462920$%han@samsung.com>

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;



      reply	other threads:[~2013-02-15 23:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-15  7:45 [PATCH] rtc: max77686: add missing variable initialization Jingoo Han
2013-02-15 23:14 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130215151430.0cf4bfb2.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=a.zummo@towertech.it \
    --cc=jg1.han@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).