diff options
Diffstat (limited to 'drivers/ieee1394/csr1212.c')
-rw-r--r-- | drivers/ieee1394/csr1212.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c index 61ddd5d37eff..15773544234b 100644 --- a/drivers/ieee1394/csr1212.c +++ b/drivers/ieee1394/csr1212.c | |||
@@ -1261,7 +1261,7 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr) | |||
1261 | return CSR1212_EINVAL; | 1261 | return CSR1212_EINVAL; |
1262 | #endif | 1262 | #endif |
1263 | 1263 | ||
1264 | cr = CSR1212_MALLOC(sizeof(struct csr1212_cache_region)); | 1264 | cr = CSR1212_MALLOC(sizeof(*cr)); |
1265 | if (!cr) | 1265 | if (!cr) |
1266 | return CSR1212_ENOMEM; | 1266 | return CSR1212_ENOMEM; |
1267 | 1267 | ||
@@ -1393,8 +1393,7 @@ int csr1212_parse_keyval(struct csr1212_keyval *kv, | |||
1393 | case CSR1212_KV_TYPE_LEAF: | 1393 | case CSR1212_KV_TYPE_LEAF: |
1394 | if (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM) { | 1394 | if (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM) { |
1395 | kv->value.leaf.data = CSR1212_MALLOC(quads_to_bytes(kvi_len)); | 1395 | kv->value.leaf.data = CSR1212_MALLOC(quads_to_bytes(kvi_len)); |
1396 | if (!kv->value.leaf.data) | 1396 | if (!kv->value.leaf.data) { |
1397 | { | ||
1398 | ret = CSR1212_ENOMEM; | 1397 | ret = CSR1212_ENOMEM; |
1399 | goto fail; | 1398 | goto fail; |
1400 | } | 1399 | } |
@@ -1462,7 +1461,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1462 | cache->next = NULL; | 1461 | cache->next = NULL; |
1463 | csr->cache_tail = cache; | 1462 | csr->cache_tail = cache; |
1464 | cache->filled_head = | 1463 | cache->filled_head = |
1465 | CSR1212_MALLOC(sizeof(struct csr1212_cache_region)); | 1464 | CSR1212_MALLOC(sizeof(*cache->filled_head)); |
1466 | if (!cache->filled_head) { | 1465 | if (!cache->filled_head) { |
1467 | return CSR1212_ENOMEM; | 1466 | return CSR1212_ENOMEM; |
1468 | } | 1467 | } |
@@ -1484,7 +1483,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1484 | /* Now seach read portions of the cache to see if it is there. */ | 1483 | /* Now seach read portions of the cache to see if it is there. */ |
1485 | for (cr = cache->filled_head; cr; cr = cr->next) { | 1484 | for (cr = cache->filled_head; cr; cr = cr->next) { |
1486 | if (cache_index < cr->offset_start) { | 1485 | if (cache_index < cr->offset_start) { |
1487 | newcr = CSR1212_MALLOC(sizeof(struct csr1212_cache_region)); | 1486 | newcr = CSR1212_MALLOC(sizeof(*newcr)); |
1488 | if (!newcr) | 1487 | if (!newcr) |
1489 | return CSR1212_ENOMEM; | 1488 | return CSR1212_ENOMEM; |
1490 | 1489 | ||
@@ -1508,7 +1507,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1508 | 1507 | ||
1509 | if (!cr) { | 1508 | if (!cr) { |
1510 | cr = cache->filled_tail; | 1509 | cr = cache->filled_tail; |
1511 | newcr = CSR1212_MALLOC(sizeof(struct csr1212_cache_region)); | 1510 | newcr = CSR1212_MALLOC(sizeof(*newcr)); |
1512 | if (!newcr) | 1511 | if (!newcr) |
1513 | return CSR1212_ENOMEM; | 1512 | return CSR1212_ENOMEM; |
1514 | 1513 | ||
@@ -1611,15 +1610,17 @@ int csr1212_parse_csr(struct csr1212_csr *csr) | |||
1611 | csr->root_kv->valid = 0; | 1610 | csr->root_kv->valid = 0; |
1612 | csr->root_kv->next = csr->root_kv; | 1611 | csr->root_kv->next = csr->root_kv; |
1613 | csr->root_kv->prev = csr->root_kv; | 1612 | csr->root_kv->prev = csr->root_kv; |
1614 | csr1212_get_keyval(csr, csr->root_kv); | 1613 | ret = _csr1212_read_keyval(csr, csr->root_kv); |
1614 | if (ret != CSR1212_SUCCESS) | ||
1615 | return ret; | ||
1615 | 1616 | ||
1616 | /* Scan through the Root directory finding all extended ROM regions | 1617 | /* Scan through the Root directory finding all extended ROM regions |
1617 | * and make cache regions for them */ | 1618 | * and make cache regions for them */ |
1618 | for (dentry = csr->root_kv->value.directory.dentries_head; | 1619 | for (dentry = csr->root_kv->value.directory.dentries_head; |
1619 | dentry; dentry = dentry->next) { | 1620 | dentry; dentry = dentry->next) { |
1620 | if (dentry->kv->key.id == CSR1212_KV_ID_EXTENDED_ROM) { | 1621 | if (dentry->kv->key.id == CSR1212_KV_ID_EXTENDED_ROM && |
1621 | csr1212_get_keyval(csr, dentry->kv); | 1622 | !dentry->kv->valid) { |
1622 | 1623 | ret = _csr1212_read_keyval(csr, dentry->kv); | |
1623 | if (ret != CSR1212_SUCCESS) | 1624 | if (ret != CSR1212_SUCCESS) |
1624 | return ret; | 1625 | return ret; |
1625 | } | 1626 | } |