]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
ASoC: cs42l56: fix up error handling in probe
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 11 Dec 2020 10:07:59 +0000 (13:07 +0300)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Apr 2021 16:31:26 +0000 (18:31 +0200)
BugLink: https://bugs.launchpad.net/bugs/1918974
[ Upstream commit 856fe64da84c95a1d415564b981ae3908eea2a76 ]

There are two issues with this code.  The first error path forgot to set
the error code and instead returns success.  The second error path
doesn't clean up.

Fixes: 272b5edd3b8f ("ASoC: Add support for CS42L56 CODEC")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/X9NE/9nK9/TuxuL+@mwanda
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
sound/soc/codecs/cs42l56.c

index ac569ab3d30f4576726d1cbcbbc3ea7318c1ec1c..51d7a87ab4c3b86772e70a28d49f23d31090294f 100644 (file)
@@ -1248,6 +1248,7 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client,
                dev_err(&i2c_client->dev,
                        "CS42L56 Device ID (%X). Expected %X\n",
                        devid, CS42L56_DEVID);
+               ret = -EINVAL;
                goto err_enable;
        }
        alpha_rev = reg & CS42L56_AREV_MASK;
@@ -1305,7 +1306,7 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client,
        ret =  devm_snd_soc_register_component(&i2c_client->dev,
                        &soc_component_dev_cs42l56, &cs42l56_dai, 1);
        if (ret < 0)
-               return ret;
+               goto err_enable;
 
        return 0;