ASoC: fsl_mqs: Fix error handling in probe
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 4 Oct 2019 10:22:09 +0000 (13:22 +0300)
committerMark Brown <broonie@kernel.org>
Mon, 7 Oct 2019 12:53:23 +0000 (13:53 +0100)
commita9d273671440c439c4f236123c59dd839c1a0eb7
tree7a6317d0e08abbca1de79b53280ea7f02cc9a74d
parente9e8fc9ed63e7e0fb30f8612f628924fbd868467
ASoC: fsl_mqs: Fix error handling in probe

There are several problems in the error handling in fsl_mqs_probe().

1) "ret" isn't initialized on some paths.  GCC has a feature which
   warns about uninitialized variables but the code initializes "ret"
   to zero at the start of the function so the checking is turned off.
2) "gpr_np" is a pointer so initializing it to zero is confusing and
   generates a Sparse warning.
3) of_parse_phandle() doesn't return error pointers on error, it returns
   NULL.
4) If devm_snd_soc_register_component() fails then the function should
   free the "gpr_np".

Fixes: 9e28f6532c61 ("ASoC: fsl_mqs: Add MQS component driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20191004102208.GB823@mwanda
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl_mqs.c