diff options
Diffstat (limited to 'drivers/misc/iwmc3200top/fw-download.c')
-rw-r--r-- | drivers/misc/iwmc3200top/fw-download.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/misc/iwmc3200top/fw-download.c b/drivers/misc/iwmc3200top/fw-download.c index 50d431e469f5..474be9228904 100644 --- a/drivers/misc/iwmc3200top/fw-download.c +++ b/drivers/misc/iwmc3200top/fw-download.c | |||
@@ -50,8 +50,7 @@ static int iwmct_fw_parser_init(struct iwmct_priv *priv, const u8 *file, | |||
50 | parser->file = file; | 50 | parser->file = file; |
51 | parser->file_size = file_size; | 51 | parser->file_size = file_size; |
52 | parser->cur_pos = 0; | 52 | parser->cur_pos = 0; |
53 | parser->buf = NULL; | 53 | parser->entry_point = 0; |
54 | |||
55 | parser->buf = kzalloc(block_size, GFP_KERNEL); | 54 | parser->buf = kzalloc(block_size, GFP_KERNEL); |
56 | if (!parser->buf) { | 55 | if (!parser->buf) { |
57 | LOG_ERROR(priv, FW_DOWNLOAD, "kzalloc error\n"); | 56 | LOG_ERROR(priv, FW_DOWNLOAD, "kzalloc error\n"); |
@@ -298,8 +297,6 @@ int iwmct_fw_load(struct iwmct_priv *priv) | |||
298 | __le32 addr; | 297 | __le32 addr; |
299 | int ret; | 298 | int ret; |
300 | 299 | ||
301 | /* clear parser struct */ | ||
302 | memset(&priv->parser, 0, sizeof(struct iwmct_parser)); | ||
303 | 300 | ||
304 | /* get the firmware */ | 301 | /* get the firmware */ |
305 | ret = request_firmware(&raw, fw_name, &priv->func->dev); | 302 | ret = request_firmware(&raw, fw_name, &priv->func->dev); |
@@ -317,6 +314,7 @@ int iwmct_fw_load(struct iwmct_priv *priv) | |||
317 | 314 | ||
318 | LOG_INFO(priv, FW_DOWNLOAD, "Read firmware '%s'\n", fw_name); | 315 | LOG_INFO(priv, FW_DOWNLOAD, "Read firmware '%s'\n", fw_name); |
319 | 316 | ||
317 | /* clear parser struct */ | ||
320 | ret = iwmct_fw_parser_init(priv, raw->data, raw->size, priv->trans_len); | 318 | ret = iwmct_fw_parser_init(priv, raw->data, raw->size, priv->trans_len); |
321 | if (ret < 0) { | 319 | if (ret < 0) { |
322 | LOG_ERROR(priv, FW_DOWNLOAD, | 320 | LOG_ERROR(priv, FW_DOWNLOAD, |
@@ -324,7 +322,6 @@ int iwmct_fw_load(struct iwmct_priv *priv) | |||
324 | goto exit; | 322 | goto exit; |
325 | } | 323 | } |
326 | 324 | ||
327 | /* checksum */ | ||
328 | if (!iwmct_checksum(priv)) { | 325 | if (!iwmct_checksum(priv)) { |
329 | LOG_ERROR(priv, FW_DOWNLOAD, "checksum error\n"); | 326 | LOG_ERROR(priv, FW_DOWNLOAD, "checksum error\n"); |
330 | ret = -EINVAL; | 327 | ret = -EINVAL; |
@@ -333,23 +330,18 @@ int iwmct_fw_load(struct iwmct_priv *priv) | |||
333 | 330 | ||
334 | /* download firmware to device */ | 331 | /* download firmware to device */ |
335 | while (iwmct_parse_next_section(priv, &pdata, &len, &addr)) { | 332 | while (iwmct_parse_next_section(priv, &pdata, &len, &addr)) { |
336 | if (iwmct_download_section(priv, pdata, len, addr)) { | 333 | ret = iwmct_download_section(priv, pdata, len, addr); |
334 | if (ret) { | ||
337 | LOG_ERROR(priv, FW_DOWNLOAD, | 335 | LOG_ERROR(priv, FW_DOWNLOAD, |
338 | "%s download section failed\n", fw_name); | 336 | "%s download section failed\n", fw_name); |
339 | ret = -EIO; | ||
340 | goto exit; | 337 | goto exit; |
341 | } | 338 | } |
342 | } | 339 | } |
343 | 340 | ||
344 | iwmct_kick_fw(priv, !!(priv->barker & BARKER_DNLOAD_JUMP_MSK)); | 341 | ret = iwmct_kick_fw(priv, !!(priv->barker & BARKER_DNLOAD_JUMP_MSK)); |
345 | 342 | ||
346 | exit: | 343 | exit: |
347 | kfree(priv->parser.buf); | 344 | kfree(priv->parser.buf); |
348 | 345 | release_firmware(raw); | |
349 | if (raw) | ||
350 | release_firmware(raw); | ||
351 | |||
352 | raw = NULL; | ||
353 | |||
354 | return ret; | 346 | return ret; |
355 | } | 347 | } |