netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net,bonding: Add return statement in bond_create_proc_entry.
@ 2009-10-10  2:10 Rakib Mullick
  2009-10-10 19:19 ` [Bonding-devel] [PATCH] net, bonding: " Nicolas de Pesloüan
  2009-10-10 20:41 ` [PATCH netnext-2.6] bonding: change bond_create_proc_entry() to return void Nicolas de Pesloüan
  0 siblings, 2 replies; 4+ messages in thread
From: Rakib Mullick @ 2009-10-10  2:10 UTC (permalink / raw)
  To: Jay Vosburgh, netdev, linux-kernel, Andrew Morton; +Cc: bonding-devel

The function bond_create_proc_entry supposed to return int instead of void.
And fixes the following compilation warning.

drivers/net/bonding/bond_main.c: In function `bond_create_proc_entry':
drivers/net/bonding/bond_main.c:3393: warning: control reaches end of
non-void function

---
Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>

--- linus/drivers/net/bonding/bond_main.c	2009-10-09 17:38:35.000000000 +0600
+++ rakib/drivers/net/bonding/bond_main.c	2009-10-09 17:47:46.000000000 +0600
@@ -3391,6 +3391,7 @@ static void bond_destroy_proc_dir(void)

 static int bond_create_proc_entry(struct bonding *bond)
 {
+	return 0;
 }

 static void bond_remove_proc_entry(struct bonding *bond)

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

* Re: [Bonding-devel] [PATCH] net, bonding: Add return statement in bond_create_proc_entry.
  2009-10-10  2:10 [PATCH] net,bonding: Add return statement in bond_create_proc_entry Rakib Mullick
@ 2009-10-10 19:19 ` Nicolas de Pesloüan
  2009-10-10 20:41 ` [PATCH netnext-2.6] bonding: change bond_create_proc_entry() to return void Nicolas de Pesloüan
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolas de Pesloüan @ 2009-10-10 19:19 UTC (permalink / raw)
  To: Rakib Mullick
  Cc: Jay Vosburgh, netdev, linux-kernel, Andrew Morton, bonding-devel

Rakib Mullick wrote:
> The function bond_create_proc_entry supposed to return int instead of void.
> And fixes the following compilation warning.
> 
> drivers/net/bonding/bond_main.c: In function `bond_create_proc_entry':
> drivers/net/bonding/bond_main.c:3393: warning: control reaches end of
> non-void function
> 
> ---
> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
> 
> --- linus/drivers/net/bonding/bond_main.c	2009-10-09 17:38:35.000000000 +0600
> +++ rakib/drivers/net/bonding/bond_main.c	2009-10-09 17:47:46.000000000 +0600
> @@ -3391,6 +3391,7 @@ static void bond_destroy_proc_dir(void)
> 
>  static int bond_create_proc_entry(struct bonding *bond)
>  {
> +	return 0;
>  }

This empty function is defined inside the else branch of an ifdef. The corresponding non-empty 
function always return 0 and no caller of this function use the returned value.

So I suggest to change the return type of this function from int to void, instead of adding a return 
0 into the empty one.

	Nicolas.


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

* [PATCH netnext-2.6] bonding: change bond_create_proc_entry() to return void
  2009-10-10  2:10 [PATCH] net,bonding: Add return statement in bond_create_proc_entry Rakib Mullick
  2009-10-10 19:19 ` [Bonding-devel] [PATCH] net, bonding: " Nicolas de Pesloüan
@ 2009-10-10 20:41 ` Nicolas de Pesloüan
  2009-10-13  7:45   ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Nicolas de Pesloüan @ 2009-10-10 20:41 UTC (permalink / raw)
  To: fubar, davem, netdev, bonding-devel, rakib.mullick
  Cc: Nicolas de Pesloüan

The function bond_create_proc_entry is currently of type int.

Two versions of this function exist:

The one in the ifdef CONFIG_PROC_FS branch always return 0.
The one in the else branch (which is empty) return nothing.

When CONFIG_PROC_FS is undef, this cause the following warning:

drivers/net/bonding/bond_main.c: In function `bond_create_proc_entry':
drivers/net/bonding/bond_main.c:3393: warning: control reaches end of
non-void function

No caller of this function use the returned value.

So change the returned type from int to void and remove the
useless return 0; .

Signed-off-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
Reported-by: Rakib Mullick <rakib.mullick@gmail.com>
---
 drivers/net/bonding/bond_main.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index ef6af1c..feb03ad 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3375,7 +3375,7 @@ static const struct file_operations bond_info_fops = {
 	.release = seq_release,
 };
 
-static int bond_create_proc_entry(struct bonding *bond)
+static void bond_create_proc_entry(struct bonding *bond)
 {
 	struct net_device *bond_dev = bond->dev;
 
@@ -3390,8 +3390,6 @@ static int bond_create_proc_entry(struct bonding *bond)
 		else
 			memcpy(bond->proc_file_name, bond_dev->name, IFNAMSIZ);
 	}
-
-	return 0;
 }
 
 static void bond_remove_proc_entry(struct bonding *bond)
@@ -3430,7 +3428,7 @@ static void bond_destroy_proc_dir(void)
 
 #else /* !CONFIG_PROC_FS */
 
-static int bond_create_proc_entry(struct bonding *bond)
+static void bond_create_proc_entry(struct bonding *bond)
 {
 }
 
-- 
1.6.3.3


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

* Re: [PATCH netnext-2.6] bonding: change bond_create_proc_entry() to return void
  2009-10-10 20:41 ` [PATCH netnext-2.6] bonding: change bond_create_proc_entry() to return void Nicolas de Pesloüan
@ 2009-10-13  7:45   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2009-10-13  7:45 UTC (permalink / raw)
  To: nicolas.2p.debian; +Cc: fubar, netdev, bonding-devel, rakib.mullick

From: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
Date: Sat, 10 Oct 2009 22:41:47 +0200

> The function bond_create_proc_entry is currently of type int.
> 
> Two versions of this function exist:
> 
> The one in the ifdef CONFIG_PROC_FS branch always return 0.
> The one in the else branch (which is empty) return nothing.
> 
> When CONFIG_PROC_FS is undef, this cause the following warning:
> 
> drivers/net/bonding/bond_main.c: In function `bond_create_proc_entry':
> drivers/net/bonding/bond_main.c:3393: warning: control reaches end of
> non-void function
> 
> No caller of this function use the returned value.
> 
> So change the returned type from int to void and remove the
> useless return 0; .
> 
> Signed-off-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
> Reported-by: Rakib Mullick <rakib.mullick@gmail.com>

Applied, thanks.

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

end of thread, other threads:[~2009-10-13  7:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-10  2:10 [PATCH] net,bonding: Add return statement in bond_create_proc_entry Rakib Mullick
2009-10-10 19:19 ` [Bonding-devel] [PATCH] net, bonding: " Nicolas de Pesloüan
2009-10-10 20:41 ` [PATCH netnext-2.6] bonding: change bond_create_proc_entry() to return void Nicolas de Pesloüan
2009-10-13  7:45   ` David Miller

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