ssb: return -ENOMEM on alloc fail (instead of CRC check's result)
authorRafał Miłecki <zajec5@gmail.com>
Wed, 3 Nov 2010 22:28:45 +0000 (23:28 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 16 Nov 2010 21:37:03 +0000 (16:37 -0500)
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/ssb/pci.c

index 3226832df32d1e81c0acb3ac8348dc7ee9a80651..b5343ac37ee538f97b17c0239c80845d46f3a851 100644 (file)
@@ -619,7 +619,7 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
                             struct ssb_sprom *sprom)
 {
        const struct ssb_sprom *fallback;
-       int err = -ENOMEM;
+       int err;
        u16 *buf;
 
        if (!ssb_is_sprom_available(bus)) {
@@ -646,7 +646,7 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
 
        buf = kcalloc(SSB_SPROMSIZE_WORDS_R123, sizeof(u16), GFP_KERNEL);
        if (!buf)
-               goto out;
+               return -ENOMEM;
        bus->sprom_size = SSB_SPROMSIZE_WORDS_R123;
        sprom_do_read(bus, buf);
        err = sprom_check_crc(buf, bus->sprom_size);
@@ -656,7 +656,7 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
                buf = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),
                              GFP_KERNEL);
                if (!buf)
-                       goto out;
+                       return -ENOMEM;
                bus->sprom_size = SSB_SPROMSIZE_WORDS_R4;
                sprom_do_read(bus, buf);
                err = sprom_check_crc(buf, bus->sprom_size);
@@ -678,7 +678,6 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
 
 out_free:
        kfree(buf);
-out:
        return err;
 }