History

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.

Shyam Saini committed 9 years ago

Commit ca4b5eb1 parent f750e821 file · +0 −5Browse files

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t