diff mbox series

[3/9] ASoC: Intel: bytcr_wm5102: use GFP_KERNEL

Message ID 20220210204223.104181-4-Julia.Lawall@inria.fr (mailing list archive)
State Accepted
Commit 695c105933cfa04ccf84088342193ae43e37e0f5
Headers show
Series use GFP_KERNEL | expand

Commit Message

Julia Lawall Feb. 10, 2022, 8:42 p.m. UTC
Platform_driver probe functions aren't called with locks held
and thus don't need GFP_ATOMIC. Use GFP_KERNEL instead.

Problem found with Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

---
 sound/soc/intel/boards/bytcr_wm5102.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pierre-Louis Bossart Feb. 11, 2022, 12:20 a.m. UTC | #1
On 2/10/22 14:42, Julia Lawall wrote:
> Platform_driver probe functions aren't called with locks held
> and thus don't need GFP_ATOMIC. Use GFP_KERNEL instead.
> 
> Problem found with Coccinelle.

Thanks Julia, indeed it's the only case where GFP_ATOMIC is used for
machine drivers.

This was already present in the initial Android driver from Intel (2013)
[1] and missed in the multiple passes to get this upstream.

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

[1]
https://github.com/lenovo-yt2-dev/android_kernel_lenovo_baytrail/blob/cm-12.1/sound/soc/intel/board/byt_bl_wm5102.c

> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
> 
> ---
>  sound/soc/intel/boards/bytcr_wm5102.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/intel/boards/bytcr_wm5102.c b/sound/soc/intel/boards/bytcr_wm5102.c
> index 504ef4cab111..8d8e96e3cd2d 100644
> --- a/sound/soc/intel/boards/bytcr_wm5102.c
> +++ b/sound/soc/intel/boards/bytcr_wm5102.c
> @@ -389,7 +389,7 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev)
>  	bool sof_parent;
>  	int ret;
>  
> -	priv = devm_kzalloc(dev, sizeof(*priv), GFP_ATOMIC);
> +	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
>  	if (!priv)
>  		return -ENOMEM;
>  
>
Hans de Goede Feb. 11, 2022, 7:43 a.m. UTC | #2
Hi,

On 2/11/22 01:20, Pierre-Louis Bossart wrote:
> 
> 
> On 2/10/22 14:42, Julia Lawall wrote:
>> Platform_driver probe functions aren't called with locks held
>> and thus don't need GFP_ATOMIC. Use GFP_KERNEL instead.
>>
>> Problem found with Coccinelle.
> 
> Thanks Julia, indeed it's the only case where GFP_ATOMIC is used for
> machine drivers.
> 
> This was already present in the initial Android driver from Intel (2013)
> [1] and missed in the multiple passes to get this upstream.
> 
> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Yeah I should have caught this when I upstreamed the machine driver:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> 
> [1]
> https://github.com/lenovo-yt2-dev/android_kernel_lenovo_baytrail/blob/cm-12.1/sound/soc/intel/board/byt_bl_wm5102.c
> 
>>
>> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
>>
>> ---
>>  sound/soc/intel/boards/bytcr_wm5102.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/sound/soc/intel/boards/bytcr_wm5102.c b/sound/soc/intel/boards/bytcr_wm5102.c
>> index 504ef4cab111..8d8e96e3cd2d 100644
>> --- a/sound/soc/intel/boards/bytcr_wm5102.c
>> +++ b/sound/soc/intel/boards/bytcr_wm5102.c
>> @@ -389,7 +389,7 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev)
>>  	bool sof_parent;
>>  	int ret;
>>  
>> -	priv = devm_kzalloc(dev, sizeof(*priv), GFP_ATOMIC);
>> +	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
>>  	if (!priv)
>>  		return -ENOMEM;
>>  
>>
>
diff mbox series

Patch

diff --git a/sound/soc/intel/boards/bytcr_wm5102.c b/sound/soc/intel/boards/bytcr_wm5102.c
index 504ef4cab111..8d8e96e3cd2d 100644
--- a/sound/soc/intel/boards/bytcr_wm5102.c
+++ b/sound/soc/intel/boards/bytcr_wm5102.c
@@ -389,7 +389,7 @@  static int snd_byt_wm5102_mc_probe(struct platform_device *pdev)
 	bool sof_parent;
 	int ret;
 
-	priv = devm_kzalloc(dev, sizeof(*priv), GFP_ATOMIC);
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;