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
397397 struct ch_sched_params info;
398398 struct ch_sched_params tp;
399399
400− memset(&info, 0, sizeof(info));
401− memset(&tp, 0, sizeof(tp));
402−
403400 memcpy(&tp, p, sizeof(tp));
404401 /* Don't try to match class parameter */
405402 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
409406 if (e->state == SCHED_STATE_UNUSED)
410407 continue;
411408
412− memset(&info, 0, sizeof(info));
413409 memcpy(&info, &e->info, sizeof(info));
414410 /* Don't try to match class parameter */
415411 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
458454 if (!e)
459455 goto out;
460456
461− memset(&np, 0, sizeof(np));
462457 memcpy(&np, p, sizeof(np));
463458 np.u.params.class = e->idx;
464459

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