diff mbox

ASoC: cs35l35: Clear reset_gpio on the error path in probe

Message ID 1490630067-23455-1-git-send-email-ckeepax@opensource.wolfsonmicro.com (mailing list archive)
State Accepted
Commit 8e71321d19c4ed02d9eed15955b8d485bab016fc
Headers show

Commit Message

Charles Keepax March 27, 2017, 3:54 p.m. UTC
The error path in probe attempts to put the device back into reset.
Should we fail to get the reset_gpio (such as a probe defer) we will
leave the error value in there, which the gpiod_set_value_cansleep on
the error path will attempt to deference.

Fix this issue by clearing reset_gpio before we head into the error
path.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 sound/soc/codecs/cs35l35.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Austin, Brian March 27, 2017, 4:04 p.m. UTC | #1
On Mon, 27 Mar 2017, Charles Keepax wrote:

> The error path in probe attempts to put the device back into reset.
> Should we fail to get the reset_gpio (such as a probe defer) we will
> leave the error value in there, which the gpiod_set_value_cansleep on
> the error path will attempt to deference.
> 
> Fix this issue by clearing reset_gpio before we head into the error
> path.
> 
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
Acked-by: Brian Austin <brian.austin@cirrus.com>
diff mbox

Patch

diff --git a/sound/soc/codecs/cs35l35.c b/sound/soc/codecs/cs35l35.c
index 1d9f332..9688274 100644
--- a/sound/soc/codecs/cs35l35.c
+++ b/sound/soc/codecs/cs35l35.c
@@ -1412,10 +1412,10 @@  static int cs35l35_i2c_probe(struct i2c_client *i2c_client,
 						      GPIOD_OUT_LOW);
 	if (IS_ERR(cs35l35->reset_gpio)) {
 		ret = PTR_ERR(cs35l35->reset_gpio);
+		cs35l35->reset_gpio = NULL;
 		if (ret == -EBUSY) {
 			dev_info(dev,
 				 "Reset line busy, assuming shared reset\n");
-			cs35l35->reset_gpio = NULL;
 		} else {
 			dev_err(dev, "Failed to get reset GPIO: %d\n", ret);
 			goto err;