diff mbox series

fix ifnullfree.cocci warnings

Message ID alpine.DEB.2.20.1808141255470.3371@hadrien (mailing list archive)
State New, archived
Headers show
Series fix ifnullfree.cocci warnings | expand

Commit Message

Julia Lawall Aug. 14, 2018, 10:57 a.m. UTC
From: kbuild test robot <fengguang.wu@intel.com>

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes: 0099cc17a399 ("ASoC:topology:avoid error log and oops during topology free.")
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
---

Feel free to ignore this if the null test is useful in some way.

 topology.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Mark Brown Aug. 14, 2018, 2:03 p.m. UTC | #1
On Tue, Aug 14, 2018 at 12:57:57PM +0200, Julia Lawall wrote:
> From: kbuild test robot <fengguang.wu@intel.com>
> 
>  NULL check before some freeing functions is not needed.
> 
>  Based on checkpatch warning
>  "kfree(NULL) is safe this check is probably not required"
>  and kfreeaddr.cocci by Julia Lawall.
> 
> Generated by: scripts/coccinelle/free/ifnullfree.cocci
> 
> Fixes: 0099cc17a399 ("ASoC:topology:avoid error log and oops during topology free.")

This doesn't apply against current code, please check and resend (the
above commit isn't in my tree:

$ git show 0099cc17a399
fatal: ambiguous argument '0099cc17a399': unknown revision or path not in the working tree.
Julia Lawall Aug. 14, 2018, 2:10 p.m. UTC | #2
On Tue, 14 Aug 2018, Mark Brown wrote:

> On Tue, Aug 14, 2018 at 12:57:57PM +0200, Julia Lawall wrote:
> > From: kbuild test robot <fengguang.wu@intel.com>
> >
> >  NULL check before some freeing functions is not needed.
> >
> >  Based on checkpatch warning
> >  "kfree(NULL) is safe this check is probably not required"
> >  and kfreeaddr.cocci by Julia Lawall.
> >
> > Generated by: scripts/coccinelle/free/ifnullfree.cocci
> >
> > Fixes: 0099cc17a399 ("ASoC:topology:avoid error log and oops during topology free.")
>
> This doesn't apply against current code, please check and resend (the
> above commit isn't in my tree:
>
> $ git show 0099cc17a399
> fatal: ambiguous argument '0099cc17a399': unknown revision or path not in the working tree.

Sorry, I didn't keep the tree information.

julia
diff mbox series

Patch

--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -2165,8 +2165,7 @@  void snd_sof_free_topology(struct snd_so
 		/* free sroute and its private data */
 		kfree(sroute->route->source);
 		kfree(sroute->route->sink);
-		if (sroute->route->control)
-			kfree(sroute->route->control);
+		kfree(sroute->route->control);
 		kfree(sroute->route);
 		kfree(sroute->private);
 		kfree(sroute);