[alsa-devel] [PATCH 1/4] ASoC: mc13783: Fix of_node_put() call with uninitialized object
Mark Brown
broonie at kernel.org
Tue Oct 7 19:23:37 CEST 2014
On Tue, Oct 07, 2014 at 07:17:08PM +0200, Takashi Iwai wrote:
> Mark Brown wrote:
> > On Tue, Oct 07, 2014 at 06:19:51PM +0200, Takashi Iwai wrote:
> > > - struct device_node *np;
> > > + struct device_node *np = NULL;
> > No, unconditional initialisations like this are worse than the problem
> > they're trying to fix.
> Which problem they're trying to fix...?
Shutting up warnings - because they just brute forcing they mean that if
there's anything else we've missed the compiler won't be able to tell us
about it.
> Initializing with NULL for the of_node_put() at error path is a
> standard idiom. An alternative fix would be to add "if (!pdata)"
> before of_node_put(np). But this isn't really intuitive, either (and
> even more error-prone, IMO).
Well, in this case I'd just move the of_node_put() into the existing
check for pdata since we don't ever reference np outside of that anyway.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20141007/b37d7f3e/attachment-0001.sig>
More information about the Alsa-devel
mailing list