linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: Remove warnings after vsprintf %pV introducation.
@ 2010-08-31 20:35 David Miller
  2010-08-31 20:50 ` Joe Perches
  2010-08-31 21:07 ` Matthew Wilcox
  0 siblings, 2 replies; 3+ messages in thread
From: David Miller @ 2010-08-31 20:35 UTC (permalink / raw)
  To: linux-scsi; +Cc: James.Bottomley, joe, sfr


GCC warns about empty printf format strings, and after
the addition of %pV these existing such cases in the
scsi driver layer were exposed enough for the compiler
to start seeing them.

Based almost entirely upon a patch by Joe Perches.

Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index cd05e04..d0c8234 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1404,13 +1404,13 @@ void scsi_print_sense(char *name, struct scsi_cmnd *cmd)
 {
 	struct scsi_sense_hdr sshdr;
 
-	scmd_printk(KERN_INFO, cmd, "");
+	scmd_printk(KERN_INFO, cmd, " ");
 	scsi_decode_sense_buffer(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
 				 &sshdr);
 	scsi_show_sense_hdr(&sshdr);
 	scsi_decode_sense_extras(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
 				 &sshdr);
-	scmd_printk(KERN_INFO, cmd, "");
+	scmd_printk(KERN_INFO, cmd, " ");
 	scsi_show_extd_sense(sshdr.asc, sshdr.ascq);
 }
 EXPORT_SYMBOL(scsi_print_sense);
@@ -1453,7 +1453,7 @@ EXPORT_SYMBOL(scsi_show_result);
 
 void scsi_print_result(struct scsi_cmnd *cmd)
 {
-	scmd_printk(KERN_INFO, cmd, "");
+	scmd_printk(KERN_INFO, cmd, " ");
 	scsi_show_result(cmd->result);
 }
 EXPORT_SYMBOL(scsi_print_result);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 2714bec..cd71f46 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2625,15 +2625,15 @@ module_exit(exit_sd);
 static void sd_print_sense_hdr(struct scsi_disk *sdkp,
 			       struct scsi_sense_hdr *sshdr)
 {
-	sd_printk(KERN_INFO, sdkp, "");
+	sd_printk(KERN_INFO, sdkp, " ");
 	scsi_show_sense_hdr(sshdr);
-	sd_printk(KERN_INFO, sdkp, "");
+	sd_printk(KERN_INFO, sdkp, " ");
 	scsi_show_extd_sense(sshdr->asc, sshdr->ascq);
 }
 
 static void sd_print_result(struct scsi_disk *sdkp, int result)
 {
-	sd_printk(KERN_INFO, sdkp, "");
+	sd_printk(KERN_INFO, sdkp, " ");
 	scsi_show_result(result);
 }
 
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index a7bc8b7..d740a5b 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -72,10 +72,7 @@ static void sym_printl_hex(u_char *p, int n)
 
 static void sym_print_msg(struct sym_ccb *cp, char *label, u_char *msg)
 {
-	if (label)
-		sym_print_addr(cp->cmd, "%s: ", label);
-	else
-		sym_print_addr(cp->cmd, "");
+	sym_print_addr(cp->cmd, "%s: ", label);
 
 	spi_print_msg(msg);
 	printf("\n");
@@ -4558,7 +4555,8 @@ static void sym_int_sir(struct sym_hcb *np)
 			switch (np->msgin [2]) {
 			case M_X_MODIFY_DP:
 				if (DEBUG_FLAGS & DEBUG_POINTER)
-					sym_print_msg(cp, NULL, np->msgin);
+					sym_print_msg(cp, "extended msg ",
+						      np->msgin);
 				tmp = (np->msgin[3]<<24) + (np->msgin[4]<<16) + 
 				      (np->msgin[5]<<8)  + (np->msgin[6]);
 				sym_modify_dp(np, tp, cp, tmp);
@@ -4585,7 +4583,7 @@ static void sym_int_sir(struct sym_hcb *np)
 		 */
 		case M_IGN_RESIDUE:
 			if (DEBUG_FLAGS & DEBUG_POINTER)
-				sym_print_msg(cp, NULL, np->msgin);
+				sym_print_msg(cp, "half byte ", np->msgin);
 			if (cp->host_flags & HF_SENSE)
 				OUTL_DSP(np, SCRIPTA_BA(np, clrack));
 			else

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

* Re: [PATCH] scsi: Remove warnings after vsprintf %pV introducation.
  2010-08-31 20:35 [PATCH] scsi: Remove warnings after vsprintf %pV introducation David Miller
@ 2010-08-31 20:50 ` Joe Perches
  2010-08-31 21:07 ` Matthew Wilcox
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2010-08-31 20:50 UTC (permalink / raw)
  To: David Miller; +Cc: linux-scsi, James.Bottomley, sfr

On Tue, 2010-08-31 at 13:35 -0700, David Miller wrote:
> GCC warns about empty printf format strings, and after
> the addition of %pV these existing such cases in the
> scsi driver layer were exposed enough for the compiler
> to start seeing them.
> Signed-off-by: David S. Miller <davem@davemloft.net>

Thanks David.

I wonder if, or how long it'll take until, it will applied
by James or whether somebody like Steven or Andrew Morton
will have to pick it up.

cheers, Joe


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

* Re: [PATCH] scsi: Remove warnings after vsprintf %pV introducation.
  2010-08-31 20:35 [PATCH] scsi: Remove warnings after vsprintf %pV introducation David Miller
  2010-08-31 20:50 ` Joe Perches
@ 2010-08-31 21:07 ` Matthew Wilcox
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew Wilcox @ 2010-08-31 21:07 UTC (permalink / raw)
  To: David Miller; +Cc: linux-scsi, James.Bottomley, joe, sfr

On Tue, Aug 31, 2010 at 01:35:31PM -0700, David Miller wrote:
> diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
> index a7bc8b7..d740a5b 100644
> --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
> +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
> @@ -72,10 +72,7 @@ static void sym_printl_hex(u_char *p, int n)
>  
>  static void sym_print_msg(struct sym_ccb *cp, char *label, u_char *msg)
>  {
> -	if (label)
> -		sym_print_addr(cp->cmd, "%s: ", label);
> -	else
> -		sym_print_addr(cp->cmd, "");
> +	sym_print_addr(cp->cmd, "%s: ", label);
>  
>  	spi_print_msg(msg);
>  	printf("\n");
> @@ -4558,7 +4555,8 @@ static void sym_int_sir(struct sym_hcb *np)
>  			switch (np->msgin [2]) {
>  			case M_X_MODIFY_DP:
>  				if (DEBUG_FLAGS & DEBUG_POINTER)
> -					sym_print_msg(cp, NULL, np->msgin);
> +					sym_print_msg(cp, "extended msg ",
> +						      np->msgin);
>  				tmp = (np->msgin[3]<<24) + (np->msgin[4]<<16) + 
>  				      (np->msgin[5]<<8)  + (np->msgin[6]);
>  				sym_modify_dp(np, tp, cp, tmp);

The extra space before the colon looks a little weird.

> @@ -4585,7 +4583,7 @@ static void sym_int_sir(struct sym_hcb *np)
>  		 */
>  		case M_IGN_RESIDUE:
>  			if (DEBUG_FLAGS & DEBUG_POINTER)
> -				sym_print_msg(cp, NULL, np->msgin);
> +				sym_print_msg(cp, "half byte ", np->msgin);
>  			if (cp->host_flags & HF_SENSE)
>  				OUTL_DSP(np, SCRIPTA_BA(np, clrack));
>  			else

Um, half byte?  Oh, I see ...

                /*
                 *  We received a 1/2 byte message not handled from SCRIPTS.

That's a 'one or two byte message', not an 0.5 byte message :-)  There's
really nothing good to print here.  Print a space if you absolutely must,
but why the hell is GCC warning about this?

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

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

end of thread, other threads:[~2010-08-31 21:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-31 20:35 [PATCH] scsi: Remove warnings after vsprintf %pV introducation David Miller
2010-08-31 20:50 ` Joe Perches
2010-08-31 21:07 ` Matthew Wilcox

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