brcmutil: use define for boardrev string function
authorArend van Spriel <arend@broadcom.com>
Sun, 25 Jan 2015 19:31:38 +0000 (20:31 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 29 Jan 2015 07:59:09 +0000 (09:59 +0200)
Introducing a define that the caller of brcmu_boardrev_str() can
use to allocate enough room for buffer passed to the function.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/brcm80211/brcmsmac/debug.c
drivers/net/wireless/brcm80211/brcmutil/utils.c
drivers/net/wireless/brcm80211/include/brcmu_utils.h

index c9a8b9360ab14855daea5a869b02b250ba8020de..7a1fbb2e3a71768257460f7415d779d612212690 100644 (file)
@@ -78,7 +78,7 @@ int brcms_debugfs_hardware_read(struct seq_file *s, void *data)
        struct brcms_hardware *hw = drvr->wlc->hw;
        struct bcma_device *core = hw->d11core;
        struct bcma_bus *bus = core->bus;
-       char boardrev[10];
+       char boardrev[BRCMU_BOARDREV_LEN];
 
        seq_printf(s, "chipnum 0x%x\n"
                   "chiprev 0x%x\n"
index 906e89ddf31903fb4c18969b46655d8d0bd50457..34937d8e13959f4298d199399fe810b6b3d1da84 100644 (file)
@@ -267,10 +267,11 @@ char *brcmu_boardrev_str(u32 brev, char *buf)
        char c;
 
        if (brev < 0x100) {
-               snprintf(buf, 8, "%d.%d", (brev & 0xf0) >> 4, brev & 0xf);
+               snprintf(buf, BRCMU_BOARDREV_LEN, "%d.%d",
+                        (brev & 0xf0) >> 4, brev & 0xf);
        } else {
                c = (brev & 0xf000) == 0x1000 ? 'P' : 'A';
-               snprintf(buf, 8, "%c%03x", c, brev & 0xfff);
+               snprintf(buf, BRCMU_BOARDREV_LEN, "%c%03x", c, brev & 0xfff);
        }
        return buf;
 }
index a043e29f07e2cd16382b00cccc17d615d75cd5bf..197317b3fa70d9ba7e66db3a0a2be8919f1ae941 100644 (file)
@@ -218,6 +218,8 @@ void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...)
 }
 #endif
 
+#define BRCMU_BOARDREV_LEN     8
+
 char *brcmu_boardrev_str(u32 brev, char *buf);
 
 #endif                         /* _BRCMU_UTILS_H_ */