Re: [PATCH 1/2] ASoC: tlv320adcx140: Avoid accessing invalid gpio_reset

2020-09-09 Thread Mark Brown
On Wed, Sep 09, 2020 at 12:06:45PM +0200, Camel Guo wrote:
> On 9/8/20 7:20 PM, Mark Brown wrote:

> > Applied to

> > https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

> I think it is "ASoC: tlv320adcx140: Wake up codec before register setting"
> that is applied to for next not this one.

As the mail says:

> > [1/1] ASoC: tlv320adcx140: Wake up codec before accessing register
> >    commit: 1a5ce48fd667128e369fdc7fb87e21539aed21b5

You didn't send a cover letter.


signature.asc
Description: PGP signature


Re: [PATCH 1/2] ASoC: tlv320adcx140: Avoid accessing invalid gpio_reset

2020-09-09 Thread Camel Guo

Hi Peter,

Thanks for your comment. I will make a new one like what you said.

On 9/8/20 2:03 PM, Peter Ujfalusi wrote:

Hi,

On 08/09/2020 14.59, Peter Ujfalusi wrote:



On 08/09/2020 11.35, Camel Guo wrote:

From: Camel Guo 

When gpio_reset is not well defined in devicetree, the
adcx140->gpio_reset is an error code instead of NULL. In this case,
adcx140->gpio_reset should not be used by adcx140_reset. This commit
sets it NULL to avoid accessing an invalid variable.

Signed-off-by: Camel Guo 
---
  sound/soc/codecs/tlv320adcx140.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c
index 7ae6ec374be3..597dd1062943 100644
--- a/sound/soc/codecs/tlv320adcx140.c
+++ b/sound/soc/codecs/tlv320adcx140.c
@@ -984,8 +984,10 @@ static int adcx140_i2c_probe(struct i2c_client *i2c,
 
   adcx140->gpio_reset = devm_gpiod_get_optional(adcx140->dev,

 "reset", GPIOD_OUT_LOW);
-    if (IS_ERR(adcx140->gpio_reset))
+    if (IS_ERR(adcx140->gpio_reset) || adcx140->gpio_reset == NULL) {
   dev_info(>dev, "Reset GPIO not defined\n");
+    adcx140->gpio_reset = NULL;


the correct fix is to:
    dev_err(>dev, "Reset GPIO not defined\n");


no need to print, I think gpio core will do that.


    return PTR_ERR(adcx140->gpio_reset);

If the reset GPIO is specified and you get error when requesting it as
optional, there is a reason for that.
For example deferred probing.


I agree! Please ignore this patch and I will make a new one like this.




+    }
 
   adcx140->supply_areg = devm_regulator_get_optional(adcx140->dev,

  "areg");



- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki



- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki



Re: [PATCH 1/2] ASoC: tlv320adcx140: Avoid accessing invalid gpio_reset

2020-09-09 Thread Camel Guo

Mark

On 9/8/20 7:20 PM, Mark Brown wrote:

On Tue, 8 Sep 2020 10:35:20 +0200, Camel Guo wrote:

When gpio_reset is not well defined in devicetree, the
adcx140->gpio_reset is an error code instead of NULL. In this case,
adcx140->gpio_reset should not be used by adcx140_reset. This commit
sets it NULL to avoid accessing an invalid variable.


Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next


I think it is "ASoC: tlv320adcx140: Wake up codec before register 
setting" that is applied to for next not this one.




Thanks!

[1/1] ASoC: tlv320adcx140: Wake up codec before accessing register
   commit: 1a5ce48fd667128e369fdc7fb87e21539aed21b5

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


Re: [PATCH 1/2] ASoC: tlv320adcx140: Avoid accessing invalid gpio_reset

2020-09-08 Thread Peter Ujfalusi



On 08/09/2020 11.35, Camel Guo wrote:
> From: Camel Guo 
> 
> When gpio_reset is not well defined in devicetree, the
> adcx140->gpio_reset is an error code instead of NULL. In this case,
> adcx140->gpio_reset should not be used by adcx140_reset. This commit
> sets it NULL to avoid accessing an invalid variable.
> 
> Signed-off-by: Camel Guo 
> ---
>  sound/soc/codecs/tlv320adcx140.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/tlv320adcx140.c 
> b/sound/soc/codecs/tlv320adcx140.c
> index 7ae6ec374be3..597dd1062943 100644
> --- a/sound/soc/codecs/tlv320adcx140.c
> +++ b/sound/soc/codecs/tlv320adcx140.c
> @@ -984,8 +984,10 @@ static int adcx140_i2c_probe(struct i2c_client *i2c,
>  
>   adcx140->gpio_reset = devm_gpiod_get_optional(adcx140->dev,
> "reset", GPIOD_OUT_LOW);
> - if (IS_ERR(adcx140->gpio_reset))
> + if (IS_ERR(adcx140->gpio_reset) || adcx140->gpio_reset == NULL) {
>   dev_info(>dev, "Reset GPIO not defined\n");
> + adcx140->gpio_reset = NULL;

the correct fix is to:
dev_err(>dev, "Reset GPIO not defined\n");
return PTR_ERR(adcx140->gpio_reset);

If the reset GPIO is specified and you get error when requesting it as
optional, there is a reason for that.
For example deferred probing.

> + }
>  
>   adcx140->supply_areg = devm_regulator_get_optional(adcx140->dev,
>  "areg");
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki



Re: [PATCH 1/2] ASoC: tlv320adcx140: Avoid accessing invalid gpio_reset

2020-09-08 Thread Peter Ujfalusi
Hi,

On 08/09/2020 14.59, Peter Ujfalusi wrote:
> 
> 
> On 08/09/2020 11.35, Camel Guo wrote:
>> From: Camel Guo 
>>
>> When gpio_reset is not well defined in devicetree, the
>> adcx140->gpio_reset is an error code instead of NULL. In this case,
>> adcx140->gpio_reset should not be used by adcx140_reset. This commit
>> sets it NULL to avoid accessing an invalid variable.
>>
>> Signed-off-by: Camel Guo 
>> ---
>>  sound/soc/codecs/tlv320adcx140.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/sound/soc/codecs/tlv320adcx140.c 
>> b/sound/soc/codecs/tlv320adcx140.c
>> index 7ae6ec374be3..597dd1062943 100644
>> --- a/sound/soc/codecs/tlv320adcx140.c
>> +++ b/sound/soc/codecs/tlv320adcx140.c
>> @@ -984,8 +984,10 @@ static int adcx140_i2c_probe(struct i2c_client *i2c,
>>  
>>  adcx140->gpio_reset = devm_gpiod_get_optional(adcx140->dev,
>>"reset", GPIOD_OUT_LOW);
>> -if (IS_ERR(adcx140->gpio_reset))
>> +if (IS_ERR(adcx140->gpio_reset) || adcx140->gpio_reset == NULL) {
>>  dev_info(>dev, "Reset GPIO not defined\n");
>> +adcx140->gpio_reset = NULL;
> 
> the correct fix is to:
>   dev_err(>dev, "Reset GPIO not defined\n");

no need to print, I think gpio core will do that.

>   return PTR_ERR(adcx140->gpio_reset);
> 
> If the reset GPIO is specified and you get error when requesting it as
> optional, there is a reason for that.
> For example deferred probing.
> 
>> +}
>>  
>>  adcx140->supply_areg = devm_regulator_get_optional(adcx140->dev,
>> "areg");
>>
> 
> - Péter
> 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki



Re: [PATCH 1/2] ASoC: tlv320adcx140: Avoid accessing invalid gpio_reset

2020-09-08 Thread Dan Murphy
 

Re: [PATCH 1/2] ASoC: tlv320adcx140: Avoid accessing invalid gpio_reset

2020-09-08 Thread Mark Brown
On Tue, 8 Sep 2020 10:35:20 +0200, Camel Guo wrote:
> When gpio_reset is not well defined in devicetree, the
> adcx140->gpio_reset is an error code instead of NULL. In this case,
> adcx140->gpio_reset should not be used by adcx140_reset. This commit
> sets it NULL to avoid accessing an invalid variable.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: tlv320adcx140: Wake up codec before accessing register
  commit: 1a5ce48fd667128e369fdc7fb87e21539aed21b5

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark