]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ieee1394/csr1212.c
Pull error-inject into release branch
[linux-2.6-omap-h63xx.git] / drivers / ieee1394 / csr1212.c
index 3c044fc52352a0ae341d6c25b577cd3ef2186dc8..d08166bda1c54b2938e720ce19dcfdc5a21fe222 100644 (file)
@@ -34,6 +34,7 @@
  */
 
 #include <linux/errno.h>
+#include <linux/kernel.h>
 #include <linux/string.h>
 #include <asm/bug.h>
 #include <asm/byteorder.h>
@@ -113,10 +114,7 @@ static u16 csr1212_crc16(const u32 *buffer, size_t length)
        return cpu_to_be16(crc);
 }
 
-#if 0
-/* Microsoft computes the CRC with the bytes in reverse order.  Therefore we
- * have a special version of the CRC algorithm to account for their buggy
- * software. */
+/* Microsoft computes the CRC with the bytes in reverse order. */
 static u16 csr1212_msft_crc16(const u32 *buffer, size_t length)
 {
        int shift;
@@ -135,7 +133,6 @@ static u16 csr1212_msft_crc16(const u32 *buffer, size_t length)
 
        return cpu_to_be16(crc);
 }
-#endif
 
 static struct csr1212_dentry *
 csr1212_find_keyval(struct csr1212_keyval *dir, struct csr1212_keyval *kv)
@@ -1096,13 +1093,11 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr)
                        return ret;
        }
 
-#if 0
-       /* Apparently there are too many differnt wrong implementations of the
-        * CRC algorithm that verifying them is moot. */
+       /* Apparently there are many different wrong implementations of the CRC
+        * algorithm.  We don't fail, we just warn. */
        if ((csr1212_crc16(bi->data, bi->crc_length) != bi->crc) &&
            (csr1212_msft_crc16(bi->data, bi->crc_length) != bi->crc))
-               return -EINVAL;
-#endif
+               printk(KERN_DEBUG "IEEE 1394 device has ROM CRC error\n");
 
        cr = CSR1212_MALLOC(sizeof(*cr));
        if (!cr)
@@ -1138,7 +1133,7 @@ csr1212_parse_dir_entry(struct csr1212_keyval *dir, u32 ki, u32 kv_pos)
                                          CSR1212_KV_VAL(ki));
                if (!k) {
                        ret = -ENOMEM;
-                       goto fail;
+                       goto out;
                }
 
                k->refcnt = 0;  /* Don't keep local reference when parsing. */
@@ -1149,7 +1144,7 @@ csr1212_parse_dir_entry(struct csr1212_keyval *dir, u32 ki, u32 kv_pos)
                                           CSR1212_KV_VAL(ki));
                if (!k) {
                        ret = -ENOMEM;
-                       goto fail;
+                       goto out;
                }
                k->refcnt = 0;  /* Don't keep local reference when parsing. */
                break;
@@ -1162,7 +1157,7 @@ csr1212_parse_dir_entry(struct csr1212_keyval *dir, u32 ki, u32 kv_pos)
                         * or Directories.  The Config ROM image is most likely
                         * messed up, so we'll just abort here. */
                        ret = -EIO;
-                       goto fail;
+                       goto out;
                }
 
                k = csr1212_find_keyval_offset(dir, offset);
@@ -1177,7 +1172,7 @@ csr1212_parse_dir_entry(struct csr1212_keyval *dir, u32 ki, u32 kv_pos)
 
                if (!k) {
                        ret = -ENOMEM;
-                       goto fail;
+                       goto out;
                }
                k->refcnt = 0;  /* Don't keep local reference when parsing. */
                k->valid = 0;   /* Contents not read yet so it's not valid. */
@@ -1189,8 +1184,7 @@ csr1212_parse_dir_entry(struct csr1212_keyval *dir, u32 ki, u32 kv_pos)
                dir->next = k;
        }
        ret = csr1212_attach_keyval_to_directory(dir, k);
-
-fail:
+out:
        if (ret != CSR1212_SUCCESS && k != NULL)
                free_keyval(k);
        return ret;
@@ -1208,15 +1202,11 @@ int csr1212_parse_keyval(struct csr1212_keyval *kv,
                &cache->data[bytes_to_quads(kv->offset - cache->offset)];
        kvi_len = be16_to_cpu(kvi->length);
 
-#if 0
-       /* Apparently there are too many differnt wrong implementations of the
-        * CRC algorithm that verifying them is moot. */
+       /* Apparently there are many different wrong implementations of the CRC
+        * algorithm.  We don't fail, we just warn. */
        if ((csr1212_crc16(kvi->data, kvi_len) != kvi->crc) &&
-           (csr1212_msft_crc16(kvi->data, kvi_len) != kvi->crc)) {
-               ret = -EINVAL;
-               goto fail;
-       }
-#endif
+           (csr1212_msft_crc16(kvi->data, kvi_len) != kvi->crc))
+               printk(KERN_DEBUG "IEEE 1394 device has ROM CRC error\n");
 
        switch (kv->key.type) {
        case CSR1212_KV_TYPE_DIRECTORY:
@@ -1241,7 +1231,7 @@ int csr1212_parse_keyval(struct csr1212_keyval *kv,
                        kv->value.leaf.data = CSR1212_MALLOC(size);
                        if (!kv->value.leaf.data) {
                                ret = -ENOMEM;
-                               goto fail;
+                               goto out;
                        }
 
                        kv->value.leaf.len = kvi_len;
@@ -1251,8 +1241,7 @@ int csr1212_parse_keyval(struct csr1212_keyval *kv,
        }
 
        kv->valid = 1;
-
-fail:
+out:
        return ret;
 }