* Re: ERROR: do not initialise externals to 0 or NULL
2010-07-05 16:16 ERROR: do not initialise externals to 0 or NULL Joe Eloff
@ 2010-07-05 19:36 ` Dan Carpenter
2010-07-05 20:03 ` Julia Lawall
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2010-07-05 19:36 UTC (permalink / raw)
To: kernel-janitors
On Mon, Jul 05, 2010 at 06:16:55PM +0200, Joe Eloff wrote:
> Hi,
>
> I have searched for results on this and most things I find is that it
> must be dropped.
>
You mean something like:
extern int foo = 0;
initializing an extern doesn't make sense. It doesn't matter what you
initialize it to. Gcc should warn about this. The initialization should
go where the actual variable is declared.
If that doesn't answer your question, can you send some sample code
that causes the error?
regards,
dan carpenter
> Could someone please give me an indication of ways to solve this or
> should I just leave it in the patch?
>
> Thanks,
>
> Joe
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: ERROR: do not initialise externals to 0 or NULL
2010-07-05 16:16 ERROR: do not initialise externals to 0 or NULL Joe Eloff
2010-07-05 19:36 ` Dan Carpenter
@ 2010-07-05 20:03 ` Julia Lawall
2010-07-05 20:19 ` Joe Eloff
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2010-07-05 20:03 UTC (permalink / raw)
To: kernel-janitors
On Mon, 5 Jul 2010, Dan Carpenter wrote:
> On Mon, Jul 05, 2010 at 06:16:55PM +0200, Joe Eloff wrote:
> > Hi,
> >
> > I have searched for results on this and most things I find is that it
> > must be dropped.
> >
>
> You mean something like:
>
> extern int foo = 0;
>
> initializing an extern doesn't make sense. It doesn't matter what you
> initialize it to. Gcc should warn about this. The initialization should
> go where the actual variable is declared.
>
> If that doesn't answer your question, can you send some sample code
> that causes the error?
For what it is worth, I didn't find anything with the following semantic
match:
@@
type T;
identifier x;
expression E;
@@
* extern T x = E;
This, if there actually is such a thing, I would be interested to know
about it.
julia
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: ERROR: do not initialise externals to 0 or NULL
2010-07-05 16:16 ERROR: do not initialise externals to 0 or NULL Joe Eloff
2010-07-05 19:36 ` Dan Carpenter
2010-07-05 20:03 ` Julia Lawall
@ 2010-07-05 20:19 ` Joe Eloff
2010-07-05 20:45 ` Dan Carpenter
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Joe Eloff @ 2010-07-05 20:19 UTC (permalink / raw)
To: kernel-janitors
Hi Dan,
Here is the line of code:
/* Error variable. Zero means no error. */
int dt3155_errno = 0;
no extern results in following error:
ERROR: do not initialise externals to 0 or NULL
It is declared in the globals scope at the top of the file just after
includes not in any function.
Have no idea why or how to make it go away??
Regards,
Joe
On Mon, 2010-07-05 at 21:36 +0200, Dan Carpenter wrote:
> On Mon, Jul 05, 2010 at 06:16:55PM +0200, Joe Eloff wrote:
> > Hi,
> >
> > I have searched for results on this and most things I find is that it
> > must be dropped.
> >
>
> You mean something like:
>
> extern int foo = 0;
>
> initializing an extern doesn't make sense. It doesn't matter what you
> initialize it to. Gcc should warn about this. The initialization should
> go where the actual variable is declared.
>
> If that doesn't answer your question, can you send some sample code
> that causes the error?
>
> regards,
> dan carpenter
>
> > Could someone please give me an indication of ways to solve this or
> > should I just leave it in the patch?
> >
> > Thanks,
> >
> > Joe
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: ERROR: do not initialise externals to 0 or NULL
2010-07-05 16:16 ERROR: do not initialise externals to 0 or NULL Joe Eloff
` (2 preceding siblings ...)
2010-07-05 20:19 ` Joe Eloff
@ 2010-07-05 20:45 ` Dan Carpenter
2010-07-05 20:48 ` Dan Carpenter
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2010-07-05 20:45 UTC (permalink / raw)
To: kernel-janitors
On Mon, Jul 05, 2010 at 10:19:29PM +0200, Joe Eloff wrote:
> Hi Dan,
>
> Here is the line of code:
> /* Error variable. Zero means no error. */
> int dt3155_errno = 0;
>
> no extern results in following error:
> ERROR: do not initialise externals to 0 or NULL
>
> It is declared in the globals scope at the top of the file just after
> includes not in any function.
>
> Have no idea why or how to make it go away??
Wouldn't "global" be a better word than "external"? Anyway, global
variables default to being zero so they don't need to be initialized.
/* Error variable. Zero means no error. */
int dt3155_errno;
But really this global variable is pretty ugly. It would be better to
eliminate it. You would have to modify wait_ibsyclr() somehow...
regards,
dan carpenter
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: ERROR: do not initialise externals to 0 or NULL
2010-07-05 16:16 ERROR: do not initialise externals to 0 or NULL Joe Eloff
` (3 preceding siblings ...)
2010-07-05 20:45 ` Dan Carpenter
@ 2010-07-05 20:48 ` Dan Carpenter
2010-07-05 20:53 ` Joe Eloff
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2010-07-05 20:48 UTC (permalink / raw)
To: kernel-janitors
On Mon, Jul 05, 2010 at 10:45:20PM +0200, Dan Carpenter wrote:
> /* Error variable. Zero means no error. */
> int dt3155_errno;
>
> But really this global variable is pretty ugly. It would be better to
> eliminate it. You would have to modify wait_ibsyclr() somehow...
>
The variable gets assigned but never used. Maybe try figure out if that
means there is a larger bug, otherwise you can just removed it entirely.
> regards,
> dan carpenter
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: ERROR: do not initialise externals to 0 or NULL
2010-07-05 16:16 ERROR: do not initialise externals to 0 or NULL Joe Eloff
` (4 preceding siblings ...)
2010-07-05 20:48 ` Dan Carpenter
@ 2010-07-05 20:53 ` Joe Eloff
2010-07-05 21:13 ` Joe Eloff
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Joe Eloff @ 2010-07-05 20:53 UTC (permalink / raw)
To: kernel-janitors
On Mon, 2010-07-05 at 22:45 +0200, Dan Carpenter wrote:
> On Mon, Jul 05, 2010 at 10:19:29PM +0200, Joe Eloff wrote:
> > Hi Dan,
> >
> > Here is the line of code:
> > /* Error variable. Zero means no error. */
> > int dt3155_errno = 0;
> >
> > no extern results in following error:
> > ERROR: do not initialise externals to 0 or NULL
> >
> > It is declared in the globals scope at the top of the file just after
> > includes not in any function.
> >
> > Have no idea why or how to make it go away??
>
> Wouldn't "global" be a better word than "external"? Anyway, global
> variables default to being zero so they don't need to be initialized.
>
> /* Error variable. Zero means no error. */
> int dt3155_errno;
>
> But really this global variable is pretty ugly. It would be better to
> eliminate it. You would have to modify wait_ibsyclr() somehow...
>
> regards,
> dan carpenter
>
>
Ah thanks...
Will look into it and fix it up.
Who will ever know why the result and the cause can't have the correct
message. Personally I would have said "global" but we didn't write the
message did we :(!
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: ERROR: do not initialise externals to 0 or NULL
2010-07-05 16:16 ERROR: do not initialise externals to 0 or NULL Joe Eloff
` (5 preceding siblings ...)
2010-07-05 20:53 ` Joe Eloff
@ 2010-07-05 21:13 ` Joe Eloff
2010-07-05 21:17 ` Dan Carpenter
2010-07-05 21:21 ` Joe Eloff
8 siblings, 0 replies; 10+ messages in thread
From: Joe Eloff @ 2010-07-05 21:13 UTC (permalink / raw)
To: kernel-janitors
On Mon, 2010-07-05 at 22:48 +0200, Dan Carpenter wrote:
> On Mon, Jul 05, 2010 at 10:45:20PM +0200, Dan Carpenter wrote:
> > /* Error variable. Zero means no error. */
> > int dt3155_errno;
> >
> > But really this global variable is pretty ugly. It would be better to
> > eliminate it. You would have to modify wait_ibsyclr() somehow...
> >
>
> The variable gets assigned but never used. Maybe try figure out if that
> means there is a larger bug, otherwise you can just removed it entirely.
>
> > regards,
> > dan carpenter
Saw that it never gets used but assigned as looking into it.
Regards,
Joe
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: ERROR: do not initialise externals to 0 or NULL
2010-07-05 16:16 ERROR: do not initialise externals to 0 or NULL Joe Eloff
` (6 preceding siblings ...)
2010-07-05 21:13 ` Joe Eloff
@ 2010-07-05 21:17 ` Dan Carpenter
2010-07-05 21:21 ` Joe Eloff
8 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2010-07-05 21:17 UTC (permalink / raw)
To: kernel-janitors
On Mon, Jul 05, 2010 at 10:53:37PM +0200, Joe Eloff wrote:
>
> Ah thanks...
>
> Will look into it and fix it up.
>
> Who will ever know why the result and the cause can't have the correct
> message. Personally I would have said "global" but we didn't write the
> message did we :(!
Well... No one would get upset with you if you were to send a patch for
checkpatch.pl with a better message. *hint* *hint*
regards,
dan carpenter
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: ERROR: do not initialise externals to 0 or NULL
2010-07-05 16:16 ERROR: do not initialise externals to 0 or NULL Joe Eloff
` (7 preceding siblings ...)
2010-07-05 21:17 ` Dan Carpenter
@ 2010-07-05 21:21 ` Joe Eloff
8 siblings, 0 replies; 10+ messages in thread
From: Joe Eloff @ 2010-07-05 21:21 UTC (permalink / raw)
To: kernel-janitors
On Mon, 2010-07-05 at 23:17 +0200, Dan Carpenter wrote:
> On Mon, Jul 05, 2010 at 10:53:37PM +0200, Joe Eloff wrote:
> >
> > Ah thanks...
> >
> > Will look into it and fix it up.
> >
> > Who will ever know why the result and the cause can't have the correct
> > message. Personally I would have said "global" but we didn't write the
> > message did we :(!
>
> Well... No one would get upset with you if you were to send a patch for
> checkpatch.pl with a better message. *hint* *hint*
>
> regards,
> dan carpenter
LOL will dust of my perl and look at it :) *sharp* *sharp*!
^ permalink raw reply [flat|nested] 10+ messages in thread