Re: [RFC]Documentation:accounting:getdelays.c Fix: warning: variable ‘i’ set but not used

From: Justin P. Mattock
Date: Tue Apr 12 2011 - 20:45:09 EST


On 04/12/2011 05:26 PM, Andrew Morton wrote:
On Tue, 5 Apr 2011 09:02:50 -0700
"Justin P. Mattock"<justinmattock@xxxxxxxxx> wrote:

Keep in mind there is another warning with this file, but need am unsure what might be the best solution:
Documentation/accounting/getdelays.c: In function ___get_family_id___:
Documentation/accounting/getdelays.c:172:14: warning: variable ___rc___ set but not used [-Wunused-but-set-variable]

this?

there was two warnings with that one..(or atleast that what I am seeing over here).



Subject: Documentation/accounting/getdelays.c: handle sendto() failures
From: Andrew Morton<akpm@xxxxxxxxxxxxxxxxxxxx>

Documentation/accounting/getdelays.c: In function `get_family_id':
Documentation/accounting/getdelays.c:172:14: warning: variable `rc' set but not used [-Wunused-but-set-variable]

Reported-by: "Justin P. Mattock"<justinmattock@xxxxxxxxx>
Cc: Balbir Singh<balbir@xxxxxxxxxx>
Signed-off-by: Andrew Morton<akpm@xxxxxxxxxxxxxxxxxxxx>
---

Documentation/accounting/getdelays.c | 2 ++
1 file changed, 2 insertions(+)

diff -puN Documentation/accounting/getdelays.c~documentation-accounting-getdelaysc-handle-sendto-failures Documentation/accounting/getdelays.c
--- a/Documentation/accounting/getdelays.c~documentation-accounting-getdelaysc-handle-sendto-failures
+++ a/Documentation/accounting/getdelays.c
@@ -177,6 +177,8 @@ static int get_family_id(int sd)
rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
CTRL_ATTR_FAMILY_NAME, (void *)name,
strlen(TASKSTATS_GENL_NAME)+1);
+ if (rc< 0)
+ return 0; /* sendto() failure? */

rep_len = recv(sd,&ans, sizeof(ans), 0);
if (ans.n.nlmsg_type == NLMSG_ERROR ||
_



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/