]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitcb342f0f2ce60eb04caa176db7f7c33ed62378bb
tree7a6317d0e08abbca1de79b53280ea7f02cc9a74d
parentb4b32dbaffae78b9a71546e830a145f420fcb1bc
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: c76586c50fb7 ("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