Skip to content

Commit

Permalink
qed: remove unnecessary call to memset
Browse files Browse the repository at this point in the history
call to memset to assign 0 value immediately after allocating
memory with kzalloc is unnecesaary as kzalloc allocates the memory
filled with 0 value.

Semantic patch used to resolve this issue:

@@
expression e,e2; constant c;
statement S;
@@

  e = kzalloc(e2, c);
  if(e == NULL) S
- memset(e, 0, e2);

Signed-off-by: Himanshu Jha <[email protected]>
Signed-off-by: Himanshu Jha <[email protected]>
Acked-by: Sudarsana Kalluru <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
himanshujha199640 authored and davem330 committed Sep 15, 2017
1 parent 23f4822 commit 4739df6
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion drivers/net/ethernet/qlogic/qed/qed_dcbx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,6 @@ int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn,
if (!dcbx_info)
return -ENOMEM;

memset(dcbx_info, 0, sizeof(*dcbx_info));
rc = qed_dcbx_query_params(p_hwfn, dcbx_info, QED_DCBX_OPERATIONAL_MIB);
if (rc) {
kfree(dcbx_info);
Expand Down

0 comments on commit 4739df6

Please sign in to comment.