Message ID | 33fb6b04-9986-35ee-f4e2-0ebeb79c5e23@users.sourceforge.net (mailing list archive) |
---|---|
State | Rejected, archived |
Headers | show |
On Wed, 20 Jul 2016, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 20 Jul 2016 15:10:32 +0200 > > 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> > --- > drivers/misc/cxl/of.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c > index edc4583..333256a 100644 > --- a/drivers/misc/cxl/of.c > +++ b/drivers/misc/cxl/of.c > @@ -490,8 +490,7 @@ int cxl_of_probe(struct platform_device *pdev) > adapter->slices = 0; > } > > - if (afu_np) > - of_node_put(afu_np); > + of_node_put(afu_np); > return 0; > } I don't think that the call should be there at all. The loop only exits when afu_np is NULL. Furthermore, the loop should not be written as a for loop, but rather with for_each_child_of_node. julia
On 20/07/16 23:38, Julia Lawall wrote: > I don't think that the call should be there at all. The loop only exits > when afu_np is NULL. Furthermore, the loop should not be written as a for > loop, but rather with for_each_child_of_node. Will send a patch to fix both issues shortly.
diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c index edc4583..333256a 100644 --- a/drivers/misc/cxl/of.c +++ b/drivers/misc/cxl/of.c @@ -490,8 +490,7 @@ int cxl_of_probe(struct platform_device *pdev) adapter->slices = 0; } - if (afu_np) - of_node_put(afu_np); + of_node_put(afu_np); return 0; }