netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cxgb3: Fix __must_check warning.
@ 2008-04-02  3:35 Dan Noe
  2008-04-02  9:15 ` Chris Snook
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Noe @ 2008-04-02  3:35 UTC (permalink / raw)
  To: netdev; +Cc: Dan Noe

Fix the warning:
drivers/net/cxgb3/cxgb3_main.c: In function ‘offload_open’:
drivers/net/cxgb3/cxgb3_main.c:936: warning: ignoring return value of ‘sysfs_create_group’, declared with attribute warn_unused_result

Now the return value is checked; if sysfs_create_group() returns failure,
a warning is printed, and the code continues as before.

Signed-off-by: Dan Noe <dpn@isomerica.net>
---
 drivers/net/cxgb3/cxgb3_main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

My first patch - feedback is appreciated, please be gentle.  Thanks!

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index fd2e05b..3007fe1 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1015,7 +1015,8 @@ static int offload_open(struct net_device *dev)
 	init_smt(adapter);
 
 	/* Never mind if the next step fails */
-	sysfs_create_group(&tdev->lldev->dev.kobj, &offload_attr_group);
+	if (sysfs_create_group(&tdev->lldev->dev.kobj, &offload_attr_group))
+		printk(KERN_WARNING DRV_NAME ": cannot create sysfs group\n");
 
 	/* Call back all registered clients */
 	cxgb3_add_clients(tdev);
-- 
1.5.2.5


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

* Re: [PATCH] cxgb3: Fix __must_check warning.
  2008-04-02  3:35 [PATCH] cxgb3: Fix __must_check warning Dan Noe
@ 2008-04-02  9:15 ` Chris Snook
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Snook @ 2008-04-02  9:15 UTC (permalink / raw)
  To: Dan Noe; +Cc: netdev

Dan Noe wrote:
> Fix the warning:
> drivers/net/cxgb3/cxgb3_main.c: In function ‘offload_open’:
> drivers/net/cxgb3/cxgb3_main.c:936: warning: ignoring return value of ‘sysfs_create_group’, declared with attribute warn_unused_result
> 
> Now the return value is checked; if sysfs_create_group() returns failure,
> a warning is printed, and the code continues as before.
> 
> Signed-off-by: Dan Noe <dpn@isomerica.net>
> ---
>  drivers/net/cxgb3/cxgb3_main.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> My first patch - feedback is appreciated, please be gentle.  Thanks!
> 
> diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
> index fd2e05b..3007fe1 100644
> --- a/drivers/net/cxgb3/cxgb3_main.c
> +++ b/drivers/net/cxgb3/cxgb3_main.c
> @@ -1015,7 +1015,8 @@ static int offload_open(struct net_device *dev)
>  	init_smt(adapter);
>  
>  	/* Never mind if the next step fails */
> -	sysfs_create_group(&tdev->lldev->dev.kobj, &offload_attr_group);
> +	if (sysfs_create_group(&tdev->lldev->dev.kobj, &offload_attr_group))
> +		printk(KERN_WARNING DRV_NAME ": cannot create sysfs group\n");

Two things:

1) You've obsoleted the preceding comment, so you might as well remove it.

2) The original author quite explicitly didn't think this was worth a 
printk.  printk calls expand the kernel binary, which has a cost, so we 
shouldn't be adding printk calls *just* to shut up a build warning. 
Personally, I think this is the sort of thing I might like to know about 
if I were debugging something, so it might make sense to make it a 
dev_dbg.  When DEBUG is not set, no printk gets compiled in, so the 
binary stays lean, but you can still get the message if you compile with 
DEBUG enabled.

-- Chris

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

end of thread, other threads:[~2008-04-02  9:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-02  3:35 [PATCH] cxgb3: Fix __must_check warning Dan Noe
2008-04-02  9:15 ` Chris Snook

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