diff mbox

[14/17] ASoC: rt5645: fix error handling for gpio detection

Message ID 1485461385-14544-15-git-send-email-pierre-louis.bossart@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Pierre-Louis Bossart Jan. 26, 2017, 8:09 p.m. UTC
Optional gpio handling should not cause an error status
and prevent probing.
Remove error return and move error message to dev_info

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/rt5645.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Mark Brown Jan. 31, 2017, 8 p.m. UTC | #1
On Thu, Jan 26, 2017 at 02:09:42PM -0600, Pierre-Louis Bossart wrote:
> Optional gpio handling should not cause an error status
> and prevent probing.
> Remove error return and move error message to dev_info

> @@ -3660,8 +3660,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
>  						       GPIOD_IN);
>  
>  	if (IS_ERR(rt5645->gpiod_hp_det)) {
> -		dev_err(&i2c->dev, "failed to initialize gpiod\n");
> -		return PTR_ERR(rt5645->gpiod_hp_det);
> +		dev_info(&i2c->dev, "failed to initialize gpiod\n");
>  	}

I'd expect this to depend on what the error is - the normal pattern is
to check for whatever the error code for "this doesn't exist" is and
ignore that while treating other things (especially -EPROBE_DEFER but
also other things) as errors.
Pierre-Louis Bossart Jan. 31, 2017, 8:29 p.m. UTC | #2
On 01/31/2017 02:00 PM, Mark Brown wrote:
> On Thu, Jan 26, 2017 at 02:09:42PM -0600, Pierre-Louis Bossart wrote:
>> Optional gpio handling should not cause an error status
>> and prevent probing.
>> Remove error return and move error message to dev_info
>> @@ -3660,8 +3660,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
>>   						       GPIOD_IN);
>>   
>>   	if (IS_ERR(rt5645->gpiod_hp_det)) {
>> -		dev_err(&i2c->dev, "failed to initialize gpiod\n");
>> -		return PTR_ERR(rt5645->gpiod_hp_det);
>> +		dev_info(&i2c->dev, "failed to initialize gpiod\n");
>>   	}
> I'd expect this to depend on what the error is - the normal pattern is
> to check for whatever the error code for "this doesn't exist" is and
> ignore that while treating other things (especially -EPROBE_DEFER but
> also other things) as errors.
yes, I'll apply the same filter on -ENOENT as for the test for the 
mclock last month. I should have thought about it, thanks for pointing 
this out.
diff mbox

Patch

diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 65ac841..f216f9f 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3660,8 +3660,7 @@  static int rt5645_i2c_probe(struct i2c_client *i2c,
 						       GPIOD_IN);
 
 	if (IS_ERR(rt5645->gpiod_hp_det)) {
-		dev_err(&i2c->dev, "failed to initialize gpiod\n");
-		return PTR_ERR(rt5645->gpiod_hp_det);
+		dev_info(&i2c->dev, "failed to initialize gpiod\n");
 	}
 
 	for (i = 0; i < ARRAY_SIZE(rt5645->supplies); i++)