66 */
77
88#include <linux/acpi.h>
9+ #include <linux/cleanup.h>
910#include <linux/debugfs.h>
1011#include <linux/delay.h>
1112#include <linux/io.h>
@@ -73,12 +74,11 @@ static int intel_reg_show(struct seq_file *s_file, void *data)
7374 struct sdw_intel * sdw = s_file -> private ;
7475 void __iomem * s = sdw -> link_res -> shim ;
7576 void __iomem * a = sdw -> link_res -> alh ;
76- char * buf ;
7777 ssize_t ret ;
7878 int i , j ;
7979 unsigned int links , reg ;
8080
81- buf = kzalloc (RD_BUF , GFP_KERNEL );
81+ char * buf __free ( kfree ) = kzalloc (RD_BUF , GFP_KERNEL );
8282 if (!buf )
8383 return - ENOMEM ;
8484
@@ -129,7 +129,6 @@ static int intel_reg_show(struct seq_file *s_file, void *data)
129129 ret += intel_sprintf (a , true, buf , ret , SDW_ALH_STRMZCFG (i ));
130130
131131 seq_printf (s_file , "%s" , buf );
132- kfree (buf );
133132
134133 return 0 ;
135134}
@@ -727,7 +726,6 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
727726 struct sdw_cdns_dai_runtime * dai_runtime ;
728727 struct sdw_cdns_pdi * pdi ;
729728 struct sdw_stream_config sconfig ;
730- struct sdw_port_config * pconfig ;
731729 int ch , dir ;
732730 int ret ;
733731
@@ -771,7 +769,8 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
771769 sconfig .bps = snd_pcm_format_width (params_format (params ));
772770
773771 /* Port configuration */
774- pconfig = kzalloc (sizeof (* pconfig ), GFP_KERNEL );
772+ struct sdw_port_config * pconfig __free (kfree ) = kzalloc (sizeof (* pconfig ),
773+ GFP_KERNEL );
775774 if (!pconfig )
776775 return - ENOMEM ;
777776
@@ -783,8 +782,6 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
783782 if (ret )
784783 dev_err (cdns -> dev , "add master to stream failed:%d\n" , ret );
785784
786- kfree (pconfig );
787-
788785 return ret ;
789786}
790787
0 commit comments