linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: A smatch warning I dont understand in drivers/hwmon/max16065.c
       [not found] <52002080.1070701@roeck-us.net>
@ 2013-08-06  7:31 ` Dan Carpenter
  2013-08-06 14:53   ` A sparse warning I dont understand in drivers/hwmon/max16065.c [was: smatch warning] Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-08-06  7:31 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: smatch, linux-sparse

On Mon, Aug 05, 2013 at 03:00:32PM -0700, Guenter Roeck wrote:
> Hi all,
> 
> I get the following warning while scanning drivers/hwmon/max16065.c.
> 
> drivers/hwmon/max16065.c:67:10: warning: Initializer entry defined twice
> drivers/hwmon/max16065.c:68:10:   also defined here
> drivers/hwmon/max16065.c:76:10: warning: Initializer entry defined twice
> drivers/hwmon/max16065.c:77:10:   also defined here
> 
> I must have looked at the code half a dozen times, but I just
> don't see what might be wrong.
> 
> Any idea, anyone ?

This is actually a Sparse warning not a Smatch warning.  To get the
Smatch warnings (there aren't any) do:
~/path/to/smatch/smatch_scripts/kchecker --spammy drivers/hwmon/max16065.c

This problem is here is a bug in Sparse handling arrays of _Bool.
Let me add the Sparse people to the CC list and a small test case.

static _Bool array_name[] = {
	[0] = 0,
	[1] = 0,
	[2] = 0,
	[3] = 0,
};

Sparse complains that element 1 was already initialized.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: A sparse warning I dont understand in drivers/hwmon/max16065.c [was: smatch warning]
  2013-08-06  7:31 ` A smatch warning I dont understand in drivers/hwmon/max16065.c Dan Carpenter
@ 2013-08-06 14:53   ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2013-08-06 14:53 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: smatch, linux-sparse

On 08/06/2013 12:31 AM, Dan Carpenter wrote:
> On Mon, Aug 05, 2013 at 03:00:32PM -0700, Guenter Roeck wrote:
>> Hi all,
>>
>> I get the following warning while scanning drivers/hwmon/max16065.c.
>>
>> drivers/hwmon/max16065.c:67:10: warning: Initializer entry defined twice
>> drivers/hwmon/max16065.c:68:10:   also defined here
>> drivers/hwmon/max16065.c:76:10: warning: Initializer entry defined twice
>> drivers/hwmon/max16065.c:77:10:   also defined here
>>
>> I must have looked at the code half a dozen times, but I just
>> don't see what might be wrong.
>>
>> Any idea, anyone ?
>
> This is actually a Sparse warning not a Smatch warning.  To get the
> Smatch warnings (there aren't any) do:

Thanks for the clarification. I updated the subject.

Guenter

> ~/path/to/smatch/smatch_scripts/kchecker --spammy drivers/hwmon/max16065.c
>
> This problem is here is a bug in Sparse handling arrays of _Bool.
> Let me add the Sparse people to the CC list and a small test case.
>
> static _Bool array_name[] = {
> 	[0] = 0,
> 	[1] = 0,
> 	[2] = 0,
> 	[3] = 0,
> };
>
> Sparse complains that element 1 was already initialized.
>
> regards,
> dan carpenter
>
>
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-06 14:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <52002080.1070701@roeck-us.net>
2013-08-06  7:31 ` A smatch warning I dont understand in drivers/hwmon/max16065.c Dan Carpenter
2013-08-06 14:53   ` A sparse warning I dont understand in drivers/hwmon/max16065.c [was: smatch warning] Guenter Roeck

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).