Skip to content

Commit

Permalink
[POWERPC] Avoid possible extra of_node_put in axon_msi.c
Browse files Browse the repository at this point in the history
I got this warning from gcc:
arch/powerpc/platforms/cell/axon_msi.c:118: warning: 'tmp' may be used uninitialized in this function

Which turns out to be a false positive, but pointed out that it was
possible for the error path in find_msi_translator() to do an extra
of_node_put on a node.  This fixes it by localising the ref counting
a bit.  As a side effect, the warning goes away.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Stephen Rothwell authored and Paul Mackerras committed Feb 6, 2008
1 parent de4c928 commit c6d0117
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/cell/axon_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ static struct axon_msic *find_msi_translator(struct pci_dev *dev)

tmp = dn;
dn = of_find_node_by_phandle(*ph);
of_node_put(tmp);
if (!dn) {
dev_dbg(&dev->dev,
"axon_msi: msi-translator doesn't point to a node\n");
Expand All @@ -154,7 +155,6 @@ static struct axon_msic *find_msi_translator(struct pci_dev *dev)

out_error:
of_node_put(dn);
of_node_put(tmp);

return msic;
}
Expand Down

0 comments on commit c6d0117

Please sign in to comment.