From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757008AbbCEPkt (ORCPT ); Thu, 5 Mar 2015 10:40:49 -0500 Received: from opensource.wolfsonmicro.com ([80.75.67.52]:56915 "EHLO opensource.wolfsonmicro.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752887AbbCEPks (ORCPT ); Thu, 5 Mar 2015 10:40:48 -0500 From: Charles Keepax To: broonie@kernel.org Cc: lgirdwood@gmail.com, info@crazy-audio.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, patches@opensource.wolfsonmicro.com Subject: [PATCH 3/3] ASoC: wm8804: Fix small issues in probe error paths Date: Thu, 5 Mar 2015 15:39:22 +0000 Message-Id: <1425569962-14285-3-git-send-email-ckeepax@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1425569962-14285-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> References: <1425569962-14285-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes some small issues on the probe error paths. Firstly, fail probe if we can't register the regulator notifiers as this will cause the cache to never be synchronised which will result in odd behaviour if the regulators are controllable. Secondly, we don't need to call regulator_bulk_disable if the enable fails, because the regulator core will handle this clean up for us. Finally, we need to disable the regulators if snd_soc_register_codecs fails. Signed-off-by: Charles Keepax --- sound/soc/codecs/wm8804.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c index 7804ddf..f44da83 100644 --- a/sound/soc/codecs/wm8804.c +++ b/sound/soc/codecs/wm8804.c @@ -609,6 +609,7 @@ int wm8804_probe(struct device *dev, struct regmap *regmap) dev_err(dev, "Failed to register regulator notifier: %d\n", ret); + return ret; } } @@ -616,7 +617,7 @@ int wm8804_probe(struct device *dev, struct regmap *regmap) wm8804->supplies); if (ret) { dev_err(dev, "Failed to enable supplies: %d\n", ret); - goto err_reg_enable; + return ret; } ret = regmap_read(regmap, WM8804_RST_DEVID1, &id1); @@ -653,8 +654,14 @@ int wm8804_probe(struct device *dev, struct regmap *regmap) goto err_reg_enable; } - return snd_soc_register_codec(dev, &soc_codec_dev_wm8804, - &wm8804_dai, 1); + ret = snd_soc_register_codec(dev, &soc_codec_dev_wm8804, + &wm8804_dai, 1); + if (ret < 0) { + dev_err(dev, "Failed to register CODEC: %d\n", ret); + goto err_reg_enable; + } + + return 0; err_reg_enable: regulator_bulk_disable(ARRAY_SIZE(wm8804->supplies), wm8804->supplies); -- 1.7.2.5