File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 3
3
* Copyright (c) 2016, Linaro Ltd.
4
4
* Copyright (c) 2015, Sony Mobile Communications Inc.
5
5
*/
6
+ #include <linux/cleanup.h>
6
7
#include <linux/firmware.h>
7
8
#include <linux/module.h>
8
9
#include <linux/slab.h>
@@ -198,26 +199,26 @@ static int wcnss_request_version(struct wcnss_ctrl *wcnss)
198
199
*/
199
200
static int wcnss_download_nv (struct wcnss_ctrl * wcnss , bool * expect_cbc )
200
201
{
201
- struct wcnss_download_nv_req * req ;
202
202
const struct firmware * fw ;
203
203
struct device * dev = wcnss -> dev ;
204
204
const char * nvbin = NVBIN_FILE ;
205
205
const void * data ;
206
206
ssize_t left ;
207
207
int ret ;
208
208
209
- req = kzalloc (sizeof (* req ) + NV_FRAGMENT_SIZE , GFP_KERNEL );
209
+ struct wcnss_download_nv_req * req __free (kfree ) = kzalloc (sizeof (* req ) + NV_FRAGMENT_SIZE ,
210
+ GFP_KERNEL );
210
211
if (!req )
211
212
return - ENOMEM ;
212
213
213
214
ret = of_property_read_string (dev -> of_node , "firmware-name" , & nvbin );
214
215
if (ret < 0 && ret != - EINVAL )
215
- goto free_req ;
216
+ return ret ;
216
217
217
218
ret = request_firmware (& fw , nvbin , dev );
218
219
if (ret < 0 ) {
219
220
dev_err (dev , "Failed to load nv file %s: %d\n" , nvbin , ret );
220
- goto free_req ;
221
+ return ret ;
221
222
}
222
223
223
224
data = fw -> data ;
@@ -263,8 +264,6 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
263
264
264
265
release_fw :
265
266
release_firmware (fw );
266
- free_req :
267
- kfree (req );
268
267
269
268
return ret ;
270
269
}
You can’t perform that action at this time.
0 commit comments