From patchwork Sun Jan 25 19:31:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend van Spriel X-Patchwork-Id: 5705201 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C751E9F302 for ; Sun, 25 Jan 2015 19:32:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 105E320172 for ; Sun, 25 Jan 2015 19:32:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24AE820115 for ; Sun, 25 Jan 2015 19:32:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759950AbbAYTcZ (ORCPT ); Sun, 25 Jan 2015 14:32:25 -0500 Received: from mail-gw2-out.broadcom.com ([216.31.210.63]:34025 "EHLO mail-gw2-out.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759948AbbAYTbu (ORCPT ); Sun, 25 Jan 2015 14:31:50 -0500 X-IronPort-AV: E=Sophos;i="5.09,464,1418112000"; d="scan'208";a="55513307" Received: from irvexchcas07.broadcom.com (HELO IRVEXCHCAS07.corp.ad.broadcom.com) ([10.9.208.55]) by mail-gw2-out.broadcom.com with ESMTP; 25 Jan 2015 12:09:04 -0800 Received: from IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) by IRVEXCHCAS07.corp.ad.broadcom.com (10.9.208.55) with Microsoft SMTP Server (TLS) id 14.3.174.1; Sun, 25 Jan 2015 11:31:47 -0800 Received: from mail-sj1-12.sj.broadcom.com (10.10.10.20) by IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) with Microsoft SMTP Server id 14.3.174.1; Sun, 25 Jan 2015 11:32:03 -0800 Received: from lb-bun-235.bun.broadcom.com (lb-bun-235.bun.broadcom.com [10.176.8.235]) by mail-sj1-12.sj.broadcom.com (Postfix) with ESMTP id 3B67F27A8A; Sun, 25 Jan 2015 11:31:47 -0800 (PST) Received: from arend by lb-bun-235.bun.broadcom.com with local (Exim 4.82) (envelope-from ) id 1YFSuQ-00023c-EH; Sun, 25 Jan 2015 20:31:46 +0100 From: Arend van Spriel To: Kalle Valo CC: linux-wireless , Arend van Spriel Subject: [PATCH 09/14] brcmutil: use define for boardrev string function Date: Sun, 25 Jan 2015 20:31:38 +0100 Message-ID: <1422214303-7816-10-git-send-email-arend@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422214303-7816-1-git-send-email-arend@broadcom.com> References: <1422214303-7816-1-git-send-email-arend@broadcom.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Pieter-Paul Giesberts Signed-off-by: Arend van Spriel --- drivers/net/wireless/brcm80211/brcmsmac/debug.c | 2 +- drivers/net/wireless/brcm80211/brcmutil/utils.c | 5 +++-- drivers/net/wireless/brcm80211/include/brcmu_utils.h | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/brcm80211/brcmsmac/debug.c b/drivers/net/wireless/brcm80211/brcmsmac/debug.c index c9a8b93..7a1fbb2 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/debug.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/debug.c @@ -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" diff --git a/drivers/net/wireless/brcm80211/brcmutil/utils.c b/drivers/net/wireless/brcm80211/brcmutil/utils.c index 906e89d..34937d8 100644 --- a/drivers/net/wireless/brcm80211/brcmutil/utils.c +++ b/drivers/net/wireless/brcm80211/brcmutil/utils.c @@ -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; } diff --git a/drivers/net/wireless/brcm80211/include/brcmu_utils.h b/drivers/net/wireless/brcm80211/include/brcmu_utils.h index a043e29..197317b 100644 --- a/drivers/net/wireless/brcm80211/include/brcmu_utils.h +++ b/drivers/net/wireless/brcm80211/include/brcmu_utils.h @@ -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_ */