All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Hennerich <michael.hennerich@analog.com>
To: Peter Meerwald <pmeerw@pmeerw.net>
Cc: "jic23@kernel.org" <jic23@kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"device-drivers-devel@blackfin.uclinux.org"
	<device-drivers-devel@blackfin.uclinux.org>,
	"fengguang.wu@intel.com" <fengguang.wu@intel.com>
Subject: Re: [PATCH] iio: staging: ad7298_ring: Fix maybe-uninitialized warning
Date: Mon, 16 Jul 2012 11:49:37 +0200	[thread overview]
Message-ID: <5003E3B1.909@analog.com> (raw)
In-Reply-To: <alpine.DEB.2.01.1207161124570.18056@pmeerw.net>

On 07/16/2012 11:26 AM, Peter Meerwald wrote:
>> drivers/staging/iio/adc/ad7298_ring.c:97:37: warning: 'time_ns' may
>> be used uninitialized in this function [-Wmaybe-uninitialized]
>> diff --git a/drivers/staging/iio/adc/ad7298_ring.c b/drivers/staging/iio/adc/ad7298_ring.c
>> index fd1d855..506016f 100644
>> --- a/drivers/staging/iio/adc/ad7298_ring.c
>> +++ b/drivers/staging/iio/adc/ad7298_ring.c
>> @@ -76,7 +76,7 @@ static irqreturn_t ad7298_trigger_handler(int irq, void *p)
>>   	struct iio_dev *indio_dev = pf->indio_dev;
>>   	struct ad7298_state *st = iio_priv(indio_dev);
>>   	struct iio_buffer *ring = indio_dev->buffer;
>> -	s64 time_ns;
>> +	s64 time_ns = 0;
>>   	__u16 buf[16];
>>   	int b_sent, i;
> I'd rather suggest
> s64 time_ns = iio_get_time_ns();
>
> and simplify the if (indio_dev->scan_timestamp) block
>
> p.
Well - calling a function to initialize a variable which isn't being 
used anywhere doesn't make more sense.

IMHO a more adequate fix would be to remove the timestamp argument from 
store_to(),
since it isn't used anywhere.

-- 
Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif

  reply	other threads:[~2012-07-16  9:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-16  8:42 [PATCH] iio: staging: ad7298_ring: Fix maybe-uninitialized warning michael.hennerich
2012-07-16  9:26 ` Peter Meerwald
2012-07-16  9:49   ` Michael Hennerich [this message]
2012-07-16 10:02     ` Peter Meerwald
2012-07-16 11:27       ` Jonathan Cameron

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=5003E3B1.909@analog.com \
    --to=michael.hennerich@analog.com \
    --cc=device-drivers-devel@blackfin.uclinux.org \
    --cc=fengguang.wu@intel.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.