aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/iwmc3200top
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2009-12-15 23:26:24 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-23 17:13:31 -0500
commit9fa4d67c6e4d678271798f006ca1d945e8b2bd5c (patch)
tree9be8da798c79ba7511b6805886eb5d17d111ad2c /drivers/misc/iwmc3200top
parent31d12926e37291970dd4f6e9940df3897766a81d (diff)
iwmc3200top: clean up fw_download
1. removed redundant NULL-pointers checks in iwmct_fw_load as release_firmware and kfree are NULL pointer friendly 2. remove redundant memset of the parser since the structure is fully initialized in iwmct_fw_parser_init function Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/misc/iwmc3200top')
-rw-r--r--drivers/misc/iwmc3200top/fw-download.c20
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
346exit: 343exit:
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}