[patch 6/7] [patch] rtl8192su, rtl8192u: use min_t() in store_debug_level()

From: Simon Horman
Date: Wed Dec 23 2009 - 03:58:09 EST


sizeof() returns a size_t but the other types involved
are unsigned long, so using min() results in a warning.

As sizeof() is called on an 11 character buffer defined
immediately above unsigned long is obviously wide enough
for the result.

Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

---

Compile tested only.

$ gcc --version
gcc (Debian 4.4.2-6) 4.4.2
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ make CONFIG_DEBUG_SECTION_MISMATCH=y
...
drivers/staging/rtl8192su/ieee80211/ieee80211_module.c: In function â??store_debug_levelâ??:
drivers/staging/rtl8192su/ieee80211/ieee80211_module.c:265: warning: comparison of distinct pointer types lacks a cast
...

Index: gregkh-2.6/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c
===================================================================
--- gregkh-2.6.orig/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c 2009-12-23 19:24:36.000000000 +1100
+++ gregkh-2.6/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c 2009-12-23 19:24:38.000000000 +1100
@@ -262,7 +262,7 @@ static int store_debug_level(struct file
unsigned long count, void *data)
{
char buf[] = "0x00000000";
- unsigned long len = min(sizeof(buf) - 1, count);
+ unsigned long len = min_t(unsigned long, sizeof(buf) - 1, count);
char *p = (char *)buf;
unsigned long val;

Index: gregkh-2.6/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
===================================================================
--- gregkh-2.6.orig/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c 2009-12-23 19:24:47.000000000 +1100
+++ gregkh-2.6/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c 2009-12-23 19:24:50.000000000 +1100
@@ -260,7 +260,7 @@ static int store_debug_level(struct file
unsigned long count, void *data)
{
char buf[] = "0x00000000";
- unsigned long len = min(sizeof(buf) - 1, count);
+ unsigned long len = min_t(unsigned long, sizeof(buf) - 1, count);
char *p = (char *)buf;
unsigned long val;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/