Skip to content

Commit

Permalink
of: Delete unnecessary check before calling "of_node_put()"
Browse files Browse the repository at this point in the history
The of_node_put() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
  • Loading branch information
Markus Elfring authored and Grant Likely committed Dec 3, 2014
1 parent 70161ff commit c46ca3c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/of/unittest.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,7 @@ static void __init of_selftest_changeset(void)
/* Make sure node names are constructed correctly */
selftest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")),
"'%s' not added\n", n21->full_name);
if (np)
of_node_put(np);
of_node_put(np);

mutex_lock(&of_mutex);
selftest(!of_changeset_revert(&chgset), "revert failed\n");
Expand Down

0 comments on commit c46ca3c

Please sign in to comment.