All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hpsa: correct compiler warnings introduced by hpsa-add-local-workqueue patch
@ 2015-02-06 23:44 Don Brace
  2015-02-10 16:56 ` James Bottomley
  0 siblings, 1 reply; 3+ messages in thread
From: Don Brace @ 2015-02-06 23:44 UTC (permalink / raw)
  To: scott.teel, Kevin.Barnett, james.bottomley, hch, Justin.Lindley, brace
  Cc: keescook, linux-scsi

Correct compiler warning introduced by hpsa-add-local-workqueue patch
6636e7f455b33b957c5ee016daa6de46148026ab hpsa: Use local workqueues
instead of system workqueues

Suggested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Webb Scales <webbnh@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
---
 drivers/scsi/hpsa.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 95d581c..a1cfbd3 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6831,10 +6831,8 @@ static struct workqueue_struct *hpsa_create_controller_wq(struct ctlr_info *h,
 						char *name)
 {
 	struct workqueue_struct *wq = NULL;
-	char wq_name[20];
 
-	snprintf(wq_name, sizeof(wq_name), "%s_%d_hpsa", name, h->ctlr);
-	wq = alloc_ordered_workqueue(wq_name, 0);
+	wq = alloc_ordered_workqueue("%s_%d_hpsa", 0, name, h->ctlr);
 	if (!wq)
 		dev_err(&h->pdev->dev, "failed to create %s workqueue\n", name);
 


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

* Re: [PATCH] hpsa: correct compiler warnings introduced by hpsa-add-local-workqueue patch
  2015-02-06 23:44 [PATCH] hpsa: correct compiler warnings introduced by hpsa-add-local-workqueue patch Don Brace
@ 2015-02-10 16:56 ` James Bottomley
  2015-02-10 17:52   ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2015-02-10 16:56 UTC (permalink / raw)
  To: Don Brace
  Cc: scott.teel, Kevin.Barnett, james.bottomley, hch, Justin.Lindley,
	brace, keescook, linux-scsi, Tejun Heo

On Fri, 2015-02-06 at 17:44 -0600, Don Brace wrote:
> Correct compiler warning introduced by hpsa-add-local-workqueue patch
> 6636e7f455b33b957c5ee016daa6de46148026ab hpsa: Use local workqueues
> instead of system workqueues
> 
> Suggested-by: Kees Cook <keescook@chromium.org>
> Reviewed-by: Scott Teel <scott.teel@pmcs.com>
> Reviewed-by: Webb Scales <webbnh@hp.com>
> Signed-off-by: Don Brace <don.brace@pmcs.com>
> ---
>  drivers/scsi/hpsa.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index 95d581c..a1cfbd3 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -6831,10 +6831,8 @@ static struct workqueue_struct *hpsa_create_controller_wq(struct ctlr_info *h,
>  						char *name)
>  {
>  	struct workqueue_struct *wq = NULL;
> -	char wq_name[20];
>  
> -	snprintf(wq_name, sizeof(wq_name), "%s_%d_hpsa", name, h->ctlr);
> -	wq = alloc_ordered_workqueue(wq_name, 0);
> +	wq = alloc_ordered_workqueue("%s_%d_hpsa", 0, name, h->ctlr);

It's not an objection to your patch, but what idiot did this?  There's
an extra variable there between the format and the arguments.  That
makes the pattern counterintuitive (i.e. an interface easy to get wrong)
because everywhere else, the arguments immediately follow the format
argument.  Please never, ever do this again.

By the way, the above is rhetorical ... the culprit is in the cc.

James


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

* Re: [PATCH] hpsa: correct compiler warnings introduced by hpsa-add-local-workqueue patch
  2015-02-10 16:56 ` James Bottomley
@ 2015-02-10 17:52   ` Tejun Heo
  0 siblings, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2015-02-10 17:52 UTC (permalink / raw)
  To: James Bottomley
  Cc: Don Brace, scott.teel, Kevin.Barnett, james.bottomley, hch,
	Justin.Lindley

On Tue, Feb 10, 2015 at 08:56:30AM -0800, James Bottomley wrote:
> > +	wq = alloc_ordered_workqueue("%s_%d_hpsa", 0, name, h->ctlr);
> 
> It's not an objection to your patch, but what idiot did this?  There's
> an extra variable there between the format and the arguments.  That
> makes the pattern counterintuitive (i.e. an interface easy to get wrong)
> because everywhere else, the arguments immediately follow the format
> argument.  Please never, ever do this again.
> 
> By the way, the above is rhetorical ... the culprit is in the cc.

LOL, that idiot would be me.  Well, it has a history.  Those functions
originally only took static names and only way later got augmented to
take printf format and, at that point, only few needed formatting.  I
can argue both sides of changing the parameter order.  It's one of the
easiest mistakes to spot after all.

Thanks.

-- 
tejun

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

end of thread, other threads:[~2015-02-10 17:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-06 23:44 [PATCH] hpsa: correct compiler warnings introduced by hpsa-add-local-workqueue patch Don Brace
2015-02-10 16:56 ` James Bottomley
2015-02-10 17:52   ` Tejun Heo

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.