public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 09/15] NULL noise: drivers/scsi/FlashPoint.c
       [not found] ` <20090305191602.30062.71301.stgit@f10box.hanneseder.net>
@ 2009-03-05 20:05   ` James Bottomley
  2009-03-05 20:15     ` Hannes Eder
  0 siblings, 1 reply; 4+ messages in thread
From: James Bottomley @ 2009-03-05 20:05 UTC (permalink / raw)
  To: Hannes Eder; +Cc: trivial, kernel-janitors, linux-kernel, linux-scsi

On Thu, 2009-03-05 at 20:16 +0100, Hannes Eder wrote:
> Fix this sparse warnings:
>   drivers/scsi/FlashPoint.c:906:9: warning: Using plain integer as NULL pointer
>   drivers/scsi/FlashPoint.c:907:53: warning: Using plain integer as NULL pointer
>   drivers/scsi/FlashPoint.c:922:1: warning: Using plain integer as NULL pointer
> 
> Signed-off-by: Hannes Eder <hannes@hanneseder.net>
> ---
> v2: fix checkpatch.pl issue.
> v2.1: other subject, as suggested by Al Viro
> 
>  drivers/scsi/FlashPoint.c |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c
> index b898d38..9eb2e86 100644
> --- a/drivers/scsi/FlashPoint.c
> +++ b/drivers/scsi/FlashPoint.c
> @@ -903,8 +903,8 @@ static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card);
>  static void FPT_autoLoadDefaultMap(unsigned long p_port);
>  
>  static struct sccb_mgr_tar_info FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] =
> L-    { {{0}} };
> -static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {0} };
> +    { { {NULL} } };
> +static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {NULL} };
>  static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR] = { {{0}} };
>  static struct nvram_info FPT_nvRamInfo[MAX_MB_CARDS] = { {0} };

This doesn't look right:  {0} as a structure initialiser is a C
convention for zero fill this structure; sparse should recognise this.
Of course, since these structures are static, they should be in BSS
anyway ...

> @@ -918,8 +918,7 @@ static unsigned char FPT_scamHAString[] =
>  
>  static unsigned short FPT_default_intena = 0;
>  
> -static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) = {
> -0};
> +static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) = {NULL};
>  
>  /*---------------------------------------------------------------------
>   *

James



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

* Re: [PATCH v2 09/15] NULL noise: drivers/scsi/FlashPoint.c
  2009-03-05 20:05   ` [PATCH v2 09/15] NULL noise: drivers/scsi/FlashPoint.c James Bottomley
@ 2009-03-05 20:15     ` Hannes Eder
  2009-03-05 21:55       ` [PATCH v3 " Hannes Eder
  2009-03-05 21:58       ` [PATCH v2 " James Bottomley
  0 siblings, 2 replies; 4+ messages in thread
From: Hannes Eder @ 2009-03-05 20:15 UTC (permalink / raw)
  To: James Bottomley; +Cc: trivial, kernel-janitors, linux-kernel, linux-scsi

On Thu, Mar 5, 2009 at 9:05 PM, James Bottomley
<James.Bottomley@hansenpartnership.com> wrote:
> On Thu, 2009-03-05 at 20:16 +0100, Hannes Eder wrote:
>> Fix this sparse warnings:
>>   drivers/scsi/FlashPoint.c:906:9: warning: Using plain integer as NULL pointer
>>   drivers/scsi/FlashPoint.c:907:53: warning: Using plain integer as NULL pointer
>>   drivers/scsi/FlashPoint.c:922:1: warning: Using plain integer as NULL pointer
>>
>> Signed-off-by: Hannes Eder <hannes@hanneseder.net>
>> ---
>> v2: fix checkpatch.pl issue.
>> v2.1: other subject, as suggested by Al Viro
>>
>>  drivers/scsi/FlashPoint.c |    7 +++----
>>  1 files changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c
>> index b898d38..9eb2e86 100644
>> --- a/drivers/scsi/FlashPoint.c
>> +++ b/drivers/scsi/FlashPoint.c
>> @@ -903,8 +903,8 @@ static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card);
>>  static void FPT_autoLoadDefaultMap(unsigned long p_port);
>>
>>  static struct sccb_mgr_tar_info FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] =
>> L-    { {{0}} };
>> -static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {0} };
>> +    { { {NULL} } };
>> +static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {NULL} };
>>  static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR] = { {{0}} };
>>  static struct nvram_info FPT_nvRamInfo[MAX_MB_CARDS] = { {0} };
>
> This doesn't look right:  {0} as a structure initialiser is a C
> convention for zero fill this structure; sparse should recognise this.
> Of course, since these structures are static, they should be in BSS
> anyway ...

So a proper fix is just not to initialize the variables.

... and report this issue to the sparse mailing list.

>
>> @@ -918,8 +918,7 @@ static unsigned char FPT_scamHAString[] =
>>
>>  static unsigned short FPT_default_intena = 0;
>>
>> -static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) = {
>> -0};
>> +static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) = {NULL};
>>
>>  /*---------------------------------------------------------------------
>>   *

Same her, right?
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" 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] 4+ messages in thread

* [PATCH v3 09/15] NULL noise: drivers/scsi/FlashPoint.c
  2009-03-05 20:15     ` Hannes Eder
@ 2009-03-05 21:55       ` Hannes Eder
  2009-03-05 21:58       ` [PATCH v2 " James Bottomley
  1 sibling, 0 replies; 4+ messages in thread
From: Hannes Eder @ 2009-03-05 21:55 UTC (permalink / raw)
  To: trivial; +Cc: James Bottomley, kernel-janitors, linux-kernel, linux-scsi

Fix this sparse warnings:
  drivers/scsi/FlashPoint.c:906:9: warning: Using plain integer as NULL pointer
  drivers/scsi/FlashPoint.c:907:53: warning: Using plain integer as NULL pointer
  drivers/scsi/FlashPoint.c:922:1: warning: Using plain integer as NULL pointer

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
v2: fix checkpatch.pl issue.
v2.1: other subject, as suggested by Al Viro
v3: no need to explicitly initialize the variables, as they are in the
    .bss section anyway (pointed out by James Bottomley)

 drivers/scsi/FlashPoint.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c
index b898d38..ac67307 100644
--- a/drivers/scsi/FlashPoint.c
+++ b/drivers/scsi/FlashPoint.c
@@ -902,13 +902,12 @@ static unsigned char FPT_scmachid(unsigned char p_card,
 static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card);
 static void FPT_autoLoadDefaultMap(unsigned long p_port);
 
-static struct sccb_mgr_tar_info FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] =
-    { {{0}} };
-static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {0} };
-static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR] = { {{0}} };
-static struct nvram_info FPT_nvRamInfo[MAX_MB_CARDS] = { {0} };
+static struct sccb_mgr_tar_info FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR];
+static struct sccb_card FPT_BL_Card[MAX_CARDS];
+static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR];
+static struct nvram_info FPT_nvRamInfo[MAX_MB_CARDS];
 
-static unsigned char FPT_mbCards = 0;
+static unsigned char FPT_mbCards;
 static unsigned char FPT_scamHAString[] =
     { 0x63, 0x07, 'B', 'U', 'S', 'L', 'O', 'G', 'I', 'C',
 	' ', 'B', 'T', '-', '9', '3', '0',
@@ -916,10 +915,9 @@ static unsigned char FPT_scamHAString[] =
 	0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
 };
 
-static unsigned short FPT_default_intena = 0;
+static unsigned short FPT_default_intena;
 
-static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) = {
-0};
+static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char);
 
 /*---------------------------------------------------------------------
  *


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

* Re: [PATCH v2 09/15] NULL noise: drivers/scsi/FlashPoint.c
  2009-03-05 20:15     ` Hannes Eder
  2009-03-05 21:55       ` [PATCH v3 " Hannes Eder
@ 2009-03-05 21:58       ` James Bottomley
  1 sibling, 0 replies; 4+ messages in thread
From: James Bottomley @ 2009-03-05 21:58 UTC (permalink / raw)
  To: Hannes Eder; +Cc: trivial, kernel-janitors, linux-kernel, linux-scsi

On Thu, 2009-03-05 at 21:15 +0100, Hannes Eder wrote:
> On Thu, Mar 5, 2009 at 9:05 PM, James Bottomley
> <James.Bottomley@hansenpartnership.com> wrote:
> > On Thu, 2009-03-05 at 20:16 +0100, Hannes Eder wrote:
> >> Fix this sparse warnings:
> >>   drivers/scsi/FlashPoint.c:906:9: warning: Using plain integer as NULL pointer
> >>   drivers/scsi/FlashPoint.c:907:53: warning: Using plain integer as NULL pointer
> >>   drivers/scsi/FlashPoint.c:922:1: warning: Using plain integer as NULL pointer
> >>
> >> Signed-off-by: Hannes Eder <hannes@hanneseder.net>
> >> ---
> >> v2: fix checkpatch.pl issue.
> >> v2.1: other subject, as suggested by Al Viro
> >>
> >>  drivers/scsi/FlashPoint.c |    7 +++----
> >>  1 files changed, 3 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c
> >> index b898d38..9eb2e86 100644
> >> --- a/drivers/scsi/FlashPoint.c
> >> +++ b/drivers/scsi/FlashPoint.c
> >> @@ -903,8 +903,8 @@ static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card);
> >>  static void FPT_autoLoadDefaultMap(unsigned long p_port);
> >>
> >>  static struct sccb_mgr_tar_info FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] =
> >> L-    { {{0}} };
> >> -static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {0} };
> >> +    { { {NULL} } };
> >> +static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {NULL} };
> >>  static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR] = { {{0}} };
> >>  static struct nvram_info FPT_nvRamInfo[MAX_MB_CARDS] = { {0} };
> >
> > This doesn't look right:  {0} as a structure initialiser is a C
> > convention for zero fill this structure; sparse should recognise this.
> > Of course, since these structures are static, they should be in BSS
> > anyway ...
> 
> So a proper fix is just not to initialize the variables.

That works ... and probably also teach sparse to recognise {0}.

> ... and report this issue to the sparse mailing list.
> 
> >
> >> @@ -918,8 +918,7 @@ static unsigned char FPT_scamHAString[] =
> >>
> >>  static unsigned short FPT_default_intena = 0;
> >>
> >> -static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) = {
> >> -0};
> >> +static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) = {NULL};
> >>
> >>  /*---------------------------------------------------------------------
> >>   *
> 
> Same her, right?

I had to look that one up, but yes, it appears {0} does zero initialise
an array as well.

James



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

end of thread, other threads:[~2009-03-05 21:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20090305190954.30062.44759.stgit@f10box.hanneseder.net>
     [not found] ` <20090305191602.30062.71301.stgit@f10box.hanneseder.net>
2009-03-05 20:05   ` [PATCH v2 09/15] NULL noise: drivers/scsi/FlashPoint.c James Bottomley
2009-03-05 20:15     ` Hannes Eder
2009-03-05 21:55       ` [PATCH v3 " Hannes Eder
2009-03-05 21:58       ` [PATCH v2 " James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox