Skip to contentSkip to conversation

ASoC: Intel: fix Coccinelle kfree warning

PATCH In review Firo Yang 2 participants 4 messages Apr 26, 2015 – Apr 27, 2015

Subsystems (4)
lore
Share & tools
lore

Firo Yang

author
#0 lore raw

PATCH 1/1 ASoC: Intel: fix Coccinelle kfree warning

It's not necessary to use kfree() to free memory allocated with devm_kzalloc in a probe function and using kfree leads to a double free.

---
 sound/soc/intel/haswell/sst-haswell-ipc.c | 1 -
 1 file changed, 1 deletion(-)
sound/soc/intel/haswell/sst-haswell-ipc.c +0 -1
index 344a1e9..324eceb 100644
@@ -2201,7 +2201,6 @@ dma_err:
 dsp_new_err:
 	sst_ipc_fini(ipc);
 ipc_init_err:
-	kfree(hsw);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(sst_hsw_dsp_init);
Signature · 1 line
2.1.0
#1 lore raw
Quoted 23 lines

-----Original Message-----
From: Firo Yang [mailto:[email protected]]
Sent: Sunday, April 26, 2015 11:42 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jie, Yang; Lu, Han; [email protected]; Piskorski, Pawel; [email protected]; Firo Yang
Subject: [PATCH] ASoC: Intel: fix Coccinelle kfree warning

It's not necessary to use kfree() to free memory allocated with devm_kzalloc in a probe function and using kfree leads to a double free.

---
 sound/soc/intel/haswell/sst-haswell-ipc.c | 1 -
 1 file changed, 1 deletion(-)
sound/soc/intel/haswell/sst-haswell-ipc.c +0 -0
index 344a1e9..324eceb 100644

sound/soc/intel/haswell/sst-haswell-ipc.c dma_err: · line 2204

Quoted 4 lines
sound/soc/intel/haswell/sst-haswell-ipc.c +0 -1
@@ -2201,7 +2201,6 @@ dma_err:
 dsp_new_err:
 	sst_ipc_fini(ipc);
 ipc_init_err:
-	kfree(hsw);

It has been fixed by Jin Yao 2 weeks ago:
http://git.kernel.org/cgit/linux/kernel/git/broonie/sound.git/commit/?h=for-next&id=ac98b4c015b50b1e452f8d55b612320be7f80825

~Keyon

Quoted 5 lines
sound/soc/intel/haswell/sst-haswell-ipc.c +0 -1
 	return ret;
 }
 EXPORT_SYMBOL_GPL(sst_hsw_dsp_init);
--

2.1.0

author
#2 lore raw

Thanks, Jie.

I find another simlar BUG in ./sound/soc/intel/baytrail/sst-baytrail-ipc.c::sst_byt_dsp_init() Does anyone fixed it, too?

Regards
Firo

Quoted 39 lines · Yang
Quoted 23 lines

-----Original Message-----
From: Firo Yang [mailto:[email protected]]
Sent: Sunday, April 26, 2015 11:42 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jie, Yang; Lu, Han; [email protected]; Piskorski, Pawel; [email protected]; Firo Yang
Subject: [PATCH] ASoC: Intel: fix Coccinelle kfree warning

It's not necessary to use kfree() to free memory allocated with devm_kzalloc in a probe function and using kfree leads to a double free.

---
 sound/soc/intel/haswell/sst-haswell-ipc.c | 1 -
 1 file changed, 1 deletion(-)
sound/soc/intel/haswell/sst-haswell-ipc.c +0 -0
index 344a1e9..324eceb 100644

sound/soc/intel/haswell/sst-haswell-ipc.c dma_err: · line 2204

Quoted 4 lines
sound/soc/intel/haswell/sst-haswell-ipc.c +0 -1
@@ -2201,7 +2201,6 @@ dma_err:
 dsp_new_err:
 	sst_ipc_fini(ipc);
 ipc_init_err:
-	kfree(hsw);

It has been fixed by Jin Yao 2 weeks ago:
http://git.kernel.org/cgit/linux/kernel/git/broonie/sound.git/commit/?h=for-next&id=ac98b4c015b50b1e452f8d55b612320be7f80825

~Keyon

Quoted 5 lines
sound/soc/intel/haswell/sst-haswell-ipc.c +0 -1
 	return ret;
 }
 EXPORT_SYMBOL_GPL(sst_hsw_dsp_init);
--

2.1.0

#3 lore raw
Quoted 10 lines

-----Original Message-----
From: Firo Yang [mailto:[email protected]]
Sent: Monday, April 27, 2015 3:42 PM
To: Jie, Yang
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Lu, Han; [email protected]; Piskorski, Pawel; [email protected]; Jin, Yao
Subject: Re: [PATCH] ASoC: Intel: fix Coccinelle kfree warning

Quoted 5 lines

Thanks, Jie.

I find another simlar BUG in ./sound/soc/intel/baytrail/sst-baytrail-ipc.c::sst_byt_dsp_init() Does anyone fixed it, too?

I guess so. You can refer to the for-next branch of git repo to confirm it:
git://git.kernel.org/cgit/linux/kernel/git/broonie/sound.git

~Keyon

Quoted 46 lines

Regards
Firo

Quoted 41 lines · Yang
Quoted 24 lines

-----Original Message-----
From: Firo Yang [mailto:[email protected]]
Sent: Sunday, April 26, 2015 11:42 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jie, Yang; Lu, Han; [email protected]; Piskorski, Pawel; [email protected]; Firo Yang
Subject: [PATCH] ASoC: Intel: fix Coccinelle kfree warning

It's not necessary to use kfree() to free memory allocated with devm_kzalloc in a probe function and using kfree leads to a double free.

---
 sound/soc/intel/haswell/sst-haswell-ipc.c | 1 -
 1 file changed, 1 deletion(-)
sound/soc/intel/haswell/sst-haswell-ipc.c +0 -0
index 344a1e9..324eceb 100644

sound/soc/intel/haswell/sst-haswell-ipc.c dma_err: · line 2204

Quoted 4 lines
sound/soc/intel/haswell/sst-haswell-ipc.c +0 -1
@@ -2201,7 +2201,6 @@ dma_err:
 dsp_new_err:
 	sst_ipc_fini(ipc);
 ipc_init_err:
-	kfree(hsw);

It has been fixed by Jin Yao 2 weeks ago:
http://git.kernel.org/cgit/linux/kernel/git/broonie/sound.git/commit/?h
=for-next&id=ac98b4c015b50b1e452f8d55b612320be7f80825

~Keyon

Quoted 5 lines
sound/soc/intel/haswell/sst-haswell-ipc.c +0 -1
 	return ret;
 }
 EXPORT_SYMBOL_GPL(sst_hsw_dsp_init);
--

2.1.0