lkml.org 
[lkml]   [2009]   [Dec]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[patch 6/7] [patch] rtl8192su, rtl8192u: use min_t() in store_debug_level()
From
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@verge.net.au>

---

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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-12-23 10:01    [W:0.104 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site