Commit 31fc436f authored by Arend van Spriel's avatar Arend van Spriel Committed by Kalle Valo

brcmutil: use define for boardrev string function

Introducing a define that the caller of brcmu_boardrev_str() can
use to allocate enough room for buffer passed to the function.
Reviewed-by: default avatarHante Meuleman <meuleman@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 86fec35e
...@@ -78,7 +78,7 @@ int brcms_debugfs_hardware_read(struct seq_file *s, void *data) ...@@ -78,7 +78,7 @@ int brcms_debugfs_hardware_read(struct seq_file *s, void *data)
struct brcms_hardware *hw = drvr->wlc->hw; struct brcms_hardware *hw = drvr->wlc->hw;
struct bcma_device *core = hw->d11core; struct bcma_device *core = hw->d11core;
struct bcma_bus *bus = core->bus; struct bcma_bus *bus = core->bus;
char boardrev[10]; char boardrev[BRCMU_BOARDREV_LEN];
seq_printf(s, "chipnum 0x%x\n" seq_printf(s, "chipnum 0x%x\n"
"chiprev 0x%x\n" "chiprev 0x%x\n"
......
...@@ -267,10 +267,11 @@ char *brcmu_boardrev_str(u32 brev, char *buf) ...@@ -267,10 +267,11 @@ char *brcmu_boardrev_str(u32 brev, char *buf)
char c; char c;
if (brev < 0x100) { 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 { } else {
c = (brev & 0xf000) == 0x1000 ? 'P' : 'A'; 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; return buf;
} }
......
...@@ -218,6 +218,8 @@ void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...) ...@@ -218,6 +218,8 @@ void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...)
} }
#endif #endif
#define BRCMU_BOARDREV_LEN 8
char *brcmu_boardrev_str(u32 brev, char *buf); char *brcmu_boardrev_str(u32 brev, char *buf);
#endif /* _BRCMU_UTILS_H_ */ #endif /* _BRCMU_UTILS_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment