diff options
author | Arend van Spriel <arend@broadcom.com> | 2012-03-06 09:50:47 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-06 15:16:18 -0500 |
commit | 4ac887cfdad909f16ee1886fe4fa19b452fc7fd3 (patch) | |
tree | c1097f92d77ca108ff5a3e6cec0800287fefc80b /drivers/bcma/sprom.c | |
parent | 5c17ddc4a047c59638c7eb8537aa887a1ddb9b0b (diff) |
bcma: return error in bcma_sprom_get() when fallback fails
When not SPROM is available a fallback mechanism is used. However,
when that fails the code currently continues. This patch assures
that the bcma_sprom_get() function aborts when that happens.
Cc: Rafal Milecki <zajec5@gmail.com>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma/sprom.c')
-rw-r--r-- | drivers/bcma/sprom.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c index 916ae255ff64..fba8066857d2 100644 --- a/drivers/bcma/sprom.c +++ b/drivers/bcma/sprom.c | |||
@@ -49,10 +49,23 @@ int bcma_arch_register_fallback_sprom(int (*sprom_callback)(struct bcma_bus *bus | |||
49 | static int bcma_fill_sprom_with_fallback(struct bcma_bus *bus, | 49 | static int bcma_fill_sprom_with_fallback(struct bcma_bus *bus, |
50 | struct ssb_sprom *out) | 50 | struct ssb_sprom *out) |
51 | { | 51 | { |
52 | if (!get_fallback_sprom) | 52 | int err; |
53 | return -ENOENT; | ||
54 | 53 | ||
55 | return get_fallback_sprom(bus, out); | 54 | if (!get_fallback_sprom) { |
55 | err = -ENOENT; | ||
56 | goto fail; | ||
57 | } | ||
58 | |||
59 | err = get_fallback_sprom(bus, out); | ||
60 | if (err) | ||
61 | goto fail; | ||
62 | |||
63 | pr_debug("Using SPROM revision %d provided by" | ||
64 | " platform.\n", bus->sprom.revision); | ||
65 | return 0; | ||
66 | fail: | ||
67 | pr_warn("Using fallback SPROM failed (err %d)\n", err); | ||
68 | return err; | ||
56 | } | 69 | } |
57 | 70 | ||
58 | /************************************************** | 71 | /************************************************** |
@@ -317,13 +330,7 @@ int bcma_sprom_get(struct bcma_bus *bus) | |||
317 | * available for this device in some other storage. | 330 | * available for this device in some other storage. |
318 | */ | 331 | */ |
319 | err = bcma_fill_sprom_with_fallback(bus, &bus->sprom); | 332 | err = bcma_fill_sprom_with_fallback(bus, &bus->sprom); |
320 | if (err) { | 333 | return err; |
321 | pr_warn("Using fallback SPROM failed (err %d)\n", err); | ||
322 | } else { | ||
323 | pr_debug("Using SPROM revision %d provided by" | ||
324 | " platform.\n", bus->sprom.revision); | ||
325 | return 0; | ||
326 | } | ||
327 | } | 334 | } |
328 | 335 | ||
329 | sprom = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16), | 336 | sprom = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16), |