Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Shyam Saini and committed by
David S. Miller
ca4b5eb8 f750e82e

-5
-5
drivers/net/ethernet/chelsio/cxgb4/sched.c
··· 397 397 struct ch_sched_params info; 398 398 struct ch_sched_params tp; 399 399 400 - memset(&info, 0, sizeof(info)); 401 - memset(&tp, 0, sizeof(tp)); 402 - 403 400 memcpy(&tp, p, sizeof(tp)); 404 401 /* Don't try to match class parameter */ 405 402 tp.u.params.class = SCHED_CLS_NONE; ··· 406 409 if (e->state == SCHED_STATE_UNUSED) 407 410 continue; 408 411 409 - memset(&info, 0, sizeof(info)); 410 412 memcpy(&info, &e->info, sizeof(info)); 411 413 /* Don't try to match class parameter */ 412 414 info.u.params.class = SCHED_CLS_NONE; ··· 454 458 if (!e) 455 459 goto out; 456 460 457 - memset(&np, 0, sizeof(np)); 458 461 memcpy(&np, p, sizeof(np)); 459 462 np.u.params.class = e->idx; 460 463