From patchwork Wed Feb 11 22:51:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 438952 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4847914016A for ; Thu, 12 Feb 2015 09:51:43 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754445AbbBKWvU (ORCPT ); Wed, 11 Feb 2015 17:51:20 -0500 Received: from mail-la0-f46.google.com ([209.85.215.46]:44773 "EHLO mail-la0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754300AbbBKWvS (ORCPT ); Wed, 11 Feb 2015 17:51:18 -0500 Received: by lams18 with SMTP id s18so6502199lam.11 for ; Wed, 11 Feb 2015 14:51:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id; bh=qAeCYskLcMAUBrjQeNCZdSJhTSbdKxwjdSHUxgk6wHI=; b=aOr8oKYLJ6ytb1MOHDAIoNanBms2slGB2YMNxTf+oPW+ANVlrYiKdUePlL+idqC7+o AD6smN1xisxhLaHZZQwm7DgeGzNchYV1XVlUZ3Z6DykDa/8HSfx7eaNQFzUbwB9qet57 BNHOa7m7JbHt/rQldfPb+SN7i0a0PjxFEybFs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qAeCYskLcMAUBrjQeNCZdSJhTSbdKxwjdSHUxgk6wHI=; b=daOgOlEv4hTAMCVRq60WFr1MGfN6EPH+JoU8hhC2GaR4X94sfu6zUSMWU3yCyci0o3 WuxYbghz1wfPYg+/giPvq9UK92n57nyigasy5NwTHeJ3A26Q1PUK/00TspBH6g6ZiyqO WorRXiqb0gL6xbTTgZGqhnhxlI/5PngSRrLLKchThYXiSnOv4vRFIbp2yiPEKwderLbE gB+cHVDIrdXyUn8DtmrPpkDbwuvxNgFRg9Su4VWhLZOhyAVn+lfvph7lDN0Mo+tCfH4g Vl+1OdDQ2D1M3GSS96Tkno+luyhE2fPvsyqMQCtASIIpo58Eir03ezjCwL8Csy6RFKd+ c8KA== X-Gm-Message-State: ALoCoQmkeVmmrCuZroJO/INTBvSGCLu92SVKqBm4iCpmoaSh858WTtRgktCIWd26eZQywGJAuSfQ X-Received: by 10.112.211.168 with SMTP id nd8mr853952lbc.18.1423695076508; Wed, 11 Feb 2015 14:51:16 -0800 (PST) Received: from spencer.imf.au.dk ([130.225.20.51]) by mx.google.com with ESMTPSA id jz4sm411525lbc.36.2015.02.11.14.51.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Feb 2015 14:51:15 -0800 (PST) From: Rasmus Villemoes To: Stanislaw Gruszka , Kalle Valo Cc: Rasmus Villemoes , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iwl4965: Enable checking of format strings Date: Wed, 11 Feb 2015 23:51:08 +0100 Message-Id: <1423695069-23436-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Since these fmt_* variables are just const char*, and not const char[], gcc (and smatch) doesn't to type checking of the arguments to the printf functions. Since the linker knows perfectly well to merge identical string constants, there's no point in having three static pointers waste memory and give an extra level of indirection. This removes over 100 "non-constant format argument" warnings from smatch, accounting for about 20% of all such warnings in an allmodconfig. Signed-off-by: Rasmus Villemoes --- drivers/net/wireless/iwlegacy/4965-debug.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/iwlegacy/4965-debug.c b/drivers/net/wireless/iwlegacy/4965-debug.c index e0597bfdddb8..18855325cc1c 100644 --- a/drivers/net/wireless/iwlegacy/4965-debug.c +++ b/drivers/net/wireless/iwlegacy/4965-debug.c @@ -28,10 +28,9 @@ #include "common.h" #include "4965.h" -static const char *fmt_value = " %-30s %10u\n"; -static const char *fmt_table = " %-30s %10u %10u %10u %10u\n"; -static const char *fmt_header = - "%-32s current cumulative delta max\n"; +#define fmt_value " %-30s %10u\n" +#define fmt_table " %-30s %10u %10u %10u %10u\n" +#define fmt_header "%-32s current cumulative delta max\n" static int il4965_stats_flag(struct il_priv *il, char *buf, int bufsz)