From: Joe Perches <joe@perches.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
Johannes Berg <johannes.berg@intel.com>
Subject: Re: [PATCH 3/3] iwlwifi: add __printf argument checking
Date: Wed, 16 May 2012 13:58:24 -0700 [thread overview]
Message-ID: <1337201904.10019.21.camel@joe2Laptop> (raw)
In-Reply-To: <1337200851-20469-4-git-send-email-johannes@sipsolutions.net>
On Wed, 2012-05-16 at 22:40 +0200, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> Joe Perches suggested adding the __printf attribute
> to the __iwl_dbg function to check arguments; add it
> to all of the logging functions (err, warn, info, dbg
> and crit.)
>
> Change-Id: I7a2ffcd3f625ff29c65519b0c3d474bace884f9d
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> Reviewed-on: http://git-mwg.jer.intel.com/gerrit/2022
> Tested-by: Jenkins
> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Trivial comments:
Odd Reviewed-on: and Tested-by: lines.
The intel.com link does not resolve here too.
> diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
[]
> @@ -38,10 +38,10 @@ static inline bool iwl_have_debug_level(u32 level)
> }
>
> void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace,
> - const char *fmt, ...);
> -void __iwl_warn(struct device *dev, const char *fmt, ...);
> -void __iwl_info(struct device *dev, const char *fmt, ...);
> -void __iwl_crit(struct device *dev, const char *fmt, ...);
> + const char *fmt, ...) __printf(4, 5);
> +void __iwl_warn(struct device *dev, const char *fmt, ...) __printf(2, 3);
> +void __iwl_info(struct device *dev, const char *fmt, ...) __printf(2, 3);
> +void __iwl_crit(struct device *dev, const char *fmt, ...) __printf(2, 3);
As far as I know, there are very few in-kernel uses of
__printf after the function prototype (6 out of 183).
$ git grep -E "\b__printf\s*\(\s*\w+\s*,\s*\w+\s*\)\s*;" | wc -l
6
$ git grep -E "\b__printf\s*\(\s*\w+\s*,\s*\w+\s*\)" | wc -l
183
I'd prefer to keep the __printf before the return type.
next prev parent reply other threads:[~2012-05-16 20:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-16 20:40 [PATCH 0/3] iwlwifi print formatting fixes Johannes Berg
2012-05-16 20:40 ` [PATCH 1/3] iwlwifi: fix prints in iwl_rx_handle Johannes Berg
2012-05-16 20:40 ` [PATCH 2/3] iwlwifi: fix debug print in iwl_sta_calc_ht_flags Johannes Berg
2012-05-16 20:40 ` [PATCH 3/3] iwlwifi: add __printf argument checking Johannes Berg
2012-05-16 20:58 ` Joe Perches [this message]
2012-05-16 21:03 ` Johannes Berg
2012-05-16 21:11 ` Joe Perches
2012-05-16 21:05 ` [PATCH 3/3 v2] " Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1337201904.10019.21.camel@joe2Laptop \
--to=joe@perches.com \
--cc=johannes.berg@intel.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox