6
6
*/
7
7
8
8
#include <linux/acpi.h>
9
+ #include <linux/cleanup.h>
9
10
#include <linux/debugfs.h>
10
11
#include <linux/delay.h>
11
12
#include <linux/io.h>
@@ -73,12 +74,11 @@ static int intel_reg_show(struct seq_file *s_file, void *data)
73
74
struct sdw_intel * sdw = s_file -> private ;
74
75
void __iomem * s = sdw -> link_res -> shim ;
75
76
void __iomem * a = sdw -> link_res -> alh ;
76
- char * buf ;
77
77
ssize_t ret ;
78
78
int i , j ;
79
79
unsigned int links , reg ;
80
80
81
- buf = kzalloc (RD_BUF , GFP_KERNEL );
81
+ char * buf __free ( kfree ) = kzalloc (RD_BUF , GFP_KERNEL );
82
82
if (!buf )
83
83
return - ENOMEM ;
84
84
@@ -129,7 +129,6 @@ static int intel_reg_show(struct seq_file *s_file, void *data)
129
129
ret += intel_sprintf (a , true, buf , ret , SDW_ALH_STRMZCFG (i ));
130
130
131
131
seq_printf (s_file , "%s" , buf );
132
- kfree (buf );
133
132
134
133
return 0 ;
135
134
}
@@ -727,7 +726,6 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
727
726
struct sdw_cdns_dai_runtime * dai_runtime ;
728
727
struct sdw_cdns_pdi * pdi ;
729
728
struct sdw_stream_config sconfig ;
730
- struct sdw_port_config * pconfig ;
731
729
int ch , dir ;
732
730
int ret ;
733
731
@@ -771,7 +769,8 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
771
769
sconfig .bps = snd_pcm_format_width (params_format (params ));
772
770
773
771
/* Port configuration */
774
- pconfig = kzalloc (sizeof (* pconfig ), GFP_KERNEL );
772
+ struct sdw_port_config * pconfig __free (kfree ) = kzalloc (sizeof (* pconfig ),
773
+ GFP_KERNEL );
775
774
if (!pconfig )
776
775
return - ENOMEM ;
777
776
@@ -783,8 +782,6 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
783
782
if (ret )
784
783
dev_err (cdns -> dev , "add master to stream failed:%d\n" , ret );
785
784
786
- kfree (pconfig );
787
-
788
785
return ret ;
789
786
}
790
787
0 commit comments