Quellcode durchsuchen

cxgb4: Remove redundant memset before memcpy

The region set by the call to memset, immediately overwritten by
the subsequent call to memcpy and thus makes the  memset redundant.

Also remove the memset((&info, 0, sizeof(info)) on line 398 because
info is memcpy()'ed to before being used in the loop and it isn't
used outside of the loop.

Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
Reviewed-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Shyam Saini vor 9 Jahren
Ursprung
Commit
ca4b5eb88a
1 geänderte Dateien mit 0 neuen und 5 gelöschten Zeilen
  1. 0 5
      drivers/net/ethernet/chelsio/cxgb4/sched.c

+ 0 - 5
drivers/net/ethernet/chelsio/cxgb4/sched.c

@@ -397,9 +397,6 @@ static struct sched_class *t4_sched_class_lookup(struct port_info *pi,
 		struct ch_sched_params info;
 		struct ch_sched_params info;
 		struct ch_sched_params tp;
 		struct ch_sched_params tp;
 
 
-		memset(&info, 0, sizeof(info));
-		memset(&tp, 0, sizeof(tp));
-
 		memcpy(&tp, p, sizeof(tp));
 		memcpy(&tp, p, sizeof(tp));
 		/* Don't try to match class parameter */
 		/* Don't try to match class parameter */
 		tp.u.params.class = SCHED_CLS_NONE;
 		tp.u.params.class = SCHED_CLS_NONE;
@@ -409,7 +406,6 @@ static struct sched_class *t4_sched_class_lookup(struct port_info *pi,
 			if (e->state == SCHED_STATE_UNUSED)
 			if (e->state == SCHED_STATE_UNUSED)
 				continue;
 				continue;
 
 
-			memset(&info, 0, sizeof(info));
 			memcpy(&info, &e->info, sizeof(info));
 			memcpy(&info, &e->info, sizeof(info));
 			/* Don't try to match class parameter */
 			/* Don't try to match class parameter */
 			info.u.params.class = SCHED_CLS_NONE;
 			info.u.params.class = SCHED_CLS_NONE;
@@ -458,7 +454,6 @@ static struct sched_class *t4_sched_class_alloc(struct port_info *pi,
 		if (!e)
 		if (!e)
 			goto out;
 			goto out;
 
 
-		memset(&np, 0, sizeof(np));
 		memcpy(&np, p, sizeof(np));
 		memcpy(&np, p, sizeof(np));
 		np.u.params.class = e->idx;
 		np.u.params.class = e->idx;