* [patch 1/4] ASoC: dapm: fix error path in snd_soc_dapm_new_pcm
@ 2017-08-26 8:29 anish kumar
2017-08-27 12:43 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: anish kumar @ 2017-08-26 8:29 UTC (permalink / raw)
To: broonie; +Cc: anish kumar, alsa-devel, tiwai, lgirdwood
Before freeing the memory, check if it was allcoated.
Signed-off-by: anish kumar <yesanishhere@gmail.com>
---
sound/soc/soc-dapm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index dcef67a..6e10a9a 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3907,9 +3907,10 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
devm_kfree(card->dev, (void *)private_value);
outfree_link_name:
devm_kfree(card->dev, link_name);
-outfree_w_param:
for (count = 0 ; count < num_params; count++)
- devm_kfree(card->dev, (void *)w_param_text[count]);
+ if (w_param_text[count])
+ devm_kfree(card->dev, (void *)w_param_text[count]);
+outfree_w_param:
devm_kfree(card->dev, w_param_text);
return ret;
--
2.10.1 (Apple Git-78)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch 1/4] ASoC: dapm: fix error path in snd_soc_dapm_new_pcm
2017-08-26 8:29 [patch 1/4] ASoC: dapm: fix error path in snd_soc_dapm_new_pcm anish kumar
@ 2017-08-27 12:43 ` Mark Brown
2017-09-02 1:25 ` anish kumar
0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2017-08-27 12:43 UTC (permalink / raw)
To: anish kumar; +Cc: alsa-devel, tiwai, lgirdwood
[-- Attachment #1.1: Type: text/plain, Size: 423 bytes --]
On Sat, Aug 26, 2017 at 01:29:25AM -0700, anish kumar wrote:
> Before freeing the memory, check if it was allcoated.
> -outfree_w_param:
> for (count = 0 ; count < num_params; count++)
> - devm_kfree(card->dev, (void *)w_param_text[count]);
> + if (w_param_text[count])
> + devm_kfree(card->dev, (void *)w_param_text[count]);
There's no need to do this, devm_kfree() will handle null pointers fine.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 1/4] ASoC: dapm: fix error path in snd_soc_dapm_new_pcm
2017-08-27 12:43 ` Mark Brown
@ 2017-09-02 1:25 ` anish kumar
0 siblings, 0 replies; 3+ messages in thread
From: anish kumar @ 2017-09-02 1:25 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, tiwai, lgirdwood
> On Aug 27, 2017, at 5:43 AM, Mark Brown <broonie@kernel.org> wrote:
Thanks for reviewing.
>
>> On Sat, Aug 26, 2017 at 01:29:25AM -0700, anish kumar wrote:
>> Before freeing the memory, check if it was allcoated.
>
>> -outfree_w_param:
>> for (count = 0 ; count < num_params; count++)
>> - devm_kfree(card->dev, (void *)w_param_text[count]);
>> + if (w_param_text[count])
>> + devm_kfree(card->dev, (void *)w_param_text[count]);
>
> There's no need to do this, devm_kfree() will handle null pointers fine.
Got it. I am waiting for comments on my other patches in this series before sending again.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-09-02 1:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-26 8:29 [patch 1/4] ASoC: dapm: fix error path in snd_soc_dapm_new_pcm anish kumar
2017-08-27 12:43 ` Mark Brown
2017-09-02 1:25 ` anish kumar
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.