Skip to contentSkip to conversation

staging: greybus: Remove unused local variable

PATCH In review Nathan Chancellor 3 participants 3 messages May 6, 2018 – May 7, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: greybus: Remove unused local variable

Fixes the following W=1 warning: variable ‘intf_id’ set but not used [-Wunused-but-set-variable]

---
 drivers/staging/greybus/svc.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/greybus/svc.c +0 -3
index a874fed761a1..a2bb7e1a3db3 100644
@@ -1137,7 +1137,6 @@ static int gb_svc_intf_reset_recv(struct gb_operation *op)
 	struct gb_svc *svc = gb_connection_get_data(op->connection);
 	struct gb_message *request = op->request;
 	struct gb_svc_intf_reset_request *reset;
-	u8 intf_id;
 
 	if (request->payload_size < sizeof(*reset)) {
 		dev_warn(&svc->dev, "short reset request received (%zu < %zu)\n",
@@ -1146,8 +1145,6 @@ static int gb_svc_intf_reset_recv(struct gb_operation *op)
 	}
 	reset = request->payload;
 
-	intf_id = reset->intf_id;
-
 	/* FIXME Reset the interface here */
 
 	return 0;
Signature · 6 lines
2.17.0

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 21 lines · Nathan Chancellor

Fixes the following W=1 warning: variable ‘intf_id’ set but not used [-Wunused-but-set-variable]

---
 drivers/staging/greybus/svc.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/greybus/svc.c +0 -1
index a874fed761a1..a2bb7e1a3db3 100644
@@ -1137,7 +1137,6 @@ static int gb_svc_intf_reset_recv(struct gb_operation *op)
 	struct gb_svc *svc = gb_connection_get_data(op->connection);
 	struct gb_message *request = op->request;
 	struct gb_svc_intf_reset_request *reset;
-	u8 intf_id;
 
 	if (request->payload_size < sizeof(*reset)) {
 		dev_warn(&svc->dev, "short reset request received (%zu < %zu)\n",

drivers/staging/greybus/svc.c static int gb_svc_intf_reset_recv(struct gb_operation *op) · line 1150

Quoted 8 lines
drivers/staging/greybus/svc.c +0 -2
@@ -1146,8 +1145,6 @@ static int gb_svc_intf_reset_recv(struct gb_operation *op)
 	}
 	reset = request->payload;
 
-	intf_id = reset->intf_id;
-
 	/* FIXME Reset the interface here */
 
 	return 0;

Don't you get a new error after removing this, i.e "reset set but unused" ? Or the sizeof() operation on that suppresses those warnings ..

Signature · 1 line
viresh
maintainer Acked-by
#2 lore raw
Quoted 25 lines · Viresh Kumar
Quoted 24 lines · Nathan Chancellor

Fixes the following W=1 warning: variable ‘intf_id’ set but not used [-Wunused-but-set-variable]

---
 drivers/staging/greybus/svc.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/greybus/svc.c +0 -1
index a874fed761a1..a2bb7e1a3db3 100644
@@ -1137,7 +1137,6 @@ static int gb_svc_intf_reset_recv(struct gb_operation *op)
 	struct gb_svc *svc = gb_connection_get_data(op->connection);
 	struct gb_message *request = op->request;
 	struct gb_svc_intf_reset_request *reset;
-	u8 intf_id;
 
 	if (request->payload_size < sizeof(*reset)) {
 		dev_warn(&svc->dev, "short reset request received (%zu < %zu)\n",
@@ -1146,8 +1145,6 @@ static int gb_svc_intf_reset_recv(struct gb_operation *op)
 	}
 	reset = request->payload;
 
Quoted 8 lines

drivers/staging/greybus/svc.c static int gb_svc_intf_reset_recv(struct gb_operation *op) · line 1150

Quoted 5 lines
drivers/staging/greybus/svc.c +0 -2
-	intf_id = reset->intf_id;
-
 	/* FIXME Reset the interface here */
 
 	return 0;

Don't you get a new error after removing this, i.e "reset set but unused" ? Or the sizeof() operation on that suppresses those warnings ..

That was my initial reaction as well, but I failed to notice the sizeof which prevents the new warning.

Quoted 1 line

Thanks,
Johan