lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <9f50566afde93ac58ae8205316cc9d1bc2088b2f.1444053230.git.Adam.Thomson.Opensource@diasemi.com>
Date:	Mon, 5 Oct 2015 15:10:04 +0100
From:	Adam Thomson <Adam.Thomson.Opensource@...semi.com>
To:	Mark Brown <broonie@...nel.org>,
	Liam Girdwood <lgirdwood@...il.com>,
	Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>
CC:	<alsa-devel@...a-project.org>, <linux-kernel@...r.kernel.org>,
	Support Opensource <support.opensource@...semi.com>
Subject: [PATCH 1/1] ASoC: da7219: Improve error handling for regulator
 supplies

Currently if bulk_enable() of supplies fails, the code still goes on
to try and put the device into active state, and set expected IO
voltage of the device. This doesn't really make sense so code now
returns on bulk_enable() failure, with an error message. Also,
to help with debug, failure to get supplies also provides an error
message.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@...semi.com>
---

This patch is based on changes introduced under patch:

'ASoC: codecs: Add da7219 codec driver'
(Commit 6d817c0e9fd7536be76690bfdee88e8a81c16f7d, kernel/git/broonie/sound.git)

 sound/soc/codecs/da7219.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c
index 76f8fc2..c86a833 100644
--- a/sound/soc/codecs/da7219.c
+++ b/sound/soc/codecs/da7219.c
@@ -1554,8 +1554,10 @@ static int da7219_handle_supplies(struct snd_soc_codec *codec)

 	ret = devm_regulator_bulk_get(codec->dev, DA7219_NUM_SUPPLIES,
 				      da7219->supplies);
-	if (ret)
+	if (ret) {
+		dev_err(codec->dev, "Failed to get supplies");
 		return ret;
+	}

 	/* Determine VDDIO voltage provided */
 	vddio = da7219->supplies[DA7219_SUPPLY_VDDIO].consumer;
@@ -1567,6 +1569,10 @@ static int da7219_handle_supplies(struct snd_soc_codec *codec)

 	/* Enable main supplies */
 	ret = regulator_bulk_enable(DA7219_NUM_SUPPLIES, da7219->supplies);
+	if (ret) {
+		dev_err(codec->dev, "Failed to enable supplies");
+		return ret;
+	}

 	/* Ensure device in active mode */
 	snd_soc_write(codec, DA7219_SYSTEM_ACTIVE, DA7219_SYSTEM_ACTIVE_MASK);
@@ -1574,7 +1580,7 @@ static int da7219_handle_supplies(struct snd_soc_codec *codec)
 	/* Update IO voltage level range */
 	snd_soc_write(codec, DA7219_IO_CTRL, io_voltage_lvl);

-	return ret;
+	return 0;
 }

 static void da7219_handle_pdata(struct snd_soc_codec *codec)
--
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ