@@ -115,43 +115,28 @@ static int imx_scu_soc_probe(struct platform_device *pdev)
115
115
116
116
/* format soc_id value passed from SCU firmware */
117
117
val = id & 0x1f ;
118
- soc_dev_attr -> soc_id = kasprintf ( GFP_KERNEL , "0x%x" , val );
118
+ soc_dev_attr -> soc_id = devm_kasprintf ( & pdev -> dev , GFP_KERNEL , "0x%x" , val );
119
119
if (!soc_dev_attr -> soc_id )
120
120
return - ENOMEM ;
121
121
122
122
/* format revision value passed from SCU firmware */
123
123
val = (id >> 5 ) & 0xf ;
124
124
val = (((val >> 2 ) + 1 ) << 4 ) | (val & 0x3 );
125
- soc_dev_attr -> revision = kasprintf (GFP_KERNEL ,
126
- "%d.%d" ,
127
- (val >> 4 ) & 0xf ,
128
- val & 0xf );
129
- if (!soc_dev_attr -> revision ) {
130
- ret = - ENOMEM ;
131
- goto free_soc_id ;
132
- }
125
+ soc_dev_attr -> revision = devm_kasprintf (& pdev -> dev , GFP_KERNEL , "%d.%d" ,
126
+ (val >> 4 ) & 0xf , val & 0xf );
127
+ if (!soc_dev_attr -> revision )
128
+ return - ENOMEM ;
133
129
134
- soc_dev_attr -> serial_number = kasprintf (GFP_KERNEL , "%016llX" , uid );
135
- if (!soc_dev_attr -> serial_number ) {
136
- ret = - ENOMEM ;
137
- goto free_revision ;
138
- }
130
+ soc_dev_attr -> serial_number = devm_kasprintf (& pdev -> dev , GFP_KERNEL ,
131
+ "%016llX" , uid );
132
+ if (!soc_dev_attr -> serial_number )
133
+ return - ENOMEM ;
139
134
140
135
soc_dev = soc_device_register (soc_dev_attr );
141
- if (IS_ERR (soc_dev )) {
142
- ret = PTR_ERR (soc_dev );
143
- goto free_serial_number ;
144
- }
136
+ if (IS_ERR (soc_dev ))
137
+ return PTR_ERR (soc_dev );
145
138
146
139
return 0 ;
147
-
148
- free_serial_number :
149
- kfree (soc_dev_attr -> serial_number );
150
- free_revision :
151
- kfree (soc_dev_attr -> revision );
152
- free_soc_id :
153
- kfree (soc_dev_attr -> soc_id );
154
- return ret ;
155
140
}
156
141
157
142
static struct platform_driver imx_scu_soc_driver = {
0 commit comments