Skip to content

Commit

Permalink
net: Remove redundant null check before kfree in dev.c
Browse files Browse the repository at this point in the history
kfree on a null pointer is a no-op.

Signed-off-by: Sachin Kamat <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Sachin Kamat authored and davem330 committed Nov 20, 2012
1 parent 973b1b9 commit 388dfc2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1153,10 +1153,8 @@ int dev_set_alias(struct net_device *dev, const char *alias, size_t len)
return -EINVAL;

if (!len) {
if (dev->ifalias) {
kfree(dev->ifalias);
dev->ifalias = NULL;
}
kfree(dev->ifalias);
dev->ifalias = NULL;
return 0;
}

Expand Down

0 comments on commit 388dfc2

Please sign in to comment.