linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 1/3] watchdog: dw_wdt: Add __user annotation
@ 2013-09-23 10:15 Jingoo Han
  2013-09-23 10:16 ` [PATCH RESEND 2/3] watchdog: kempld_wdt: Fix bit mask definition Jingoo Han
  2013-09-23 10:17 ` [PATCH RESEND 3/3] watchdog: kempld_wdt: Add __user annotation Jingoo Han
  0 siblings, 2 replies; 3+ messages in thread
From: Jingoo Han @ 2013-09-23 10:15 UTC (permalink / raw)
  To: 'Wim Van Sebroeck'
  Cc: linux-watchdog, 'Guenter Roeck', Jamie Iles,
	'Kevin Strasser', 'Jingoo Han'

Added __user annotation to fix the following sparse warnings.

drivers/watchdog/dw_wdt.c:206:38: warning: incorrect type in argument 1 (different address spaces)
drivers/watchdog/dw_wdt.c:206:38:    expected void [noderef] <asn:1>*to
drivers/watchdog/dw_wdt.c:206:38:    got struct watchdog_info *<noident>
drivers/watchdog/dw_wdt.c:211:24: warning: incorrect type in initializer (different address spaces)
drivers/watchdog/dw_wdt.c:211:24:    expected int const [noderef] <asn:1>*register __p
drivers/watchdog/dw_wdt.c:211:24:    got int *<noident>

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jamie Iles <jamie@jamieiles.com>
---
 drivers/watchdog/dw_wdt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index e621098..cd5befb 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -203,12 +203,12 @@ static long dw_wdt_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 	switch (cmd) {
 	case WDIOC_GETSUPPORT:
-		return copy_to_user((struct watchdog_info *)arg, &dw_wdt_ident,
+		return copy_to_user((void __user *)arg, &dw_wdt_ident,
 				    sizeof(dw_wdt_ident)) ? -EFAULT : 0;
 
 	case WDIOC_GETSTATUS:
 	case WDIOC_GETBOOTSTATUS:
-		return put_user(0, (int *)arg);
+		return put_user(0, (int __user *)arg);
 
 	case WDIOC_KEEPALIVE:
 		dw_wdt_set_next_heartbeat();
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH RESEND 2/3] watchdog: kempld_wdt: Fix bit mask definition
  2013-09-23 10:15 [PATCH RESEND 1/3] watchdog: dw_wdt: Add __user annotation Jingoo Han
@ 2013-09-23 10:16 ` Jingoo Han
  2013-09-23 10:17 ` [PATCH RESEND 3/3] watchdog: kempld_wdt: Add __user annotation Jingoo Han
  1 sibling, 0 replies; 3+ messages in thread
From: Jingoo Han @ 2013-09-23 10:16 UTC (permalink / raw)
  To: 'Wim Van Sebroeck'
  Cc: linux-watchdog, 'Guenter Roeck', 'Jamie Iles',
	'Kevin Strasser', 'Jingoo Han'

STAGE_CFG bits are defined as [5:4] bits. However, '(((x) & 0x30) << 4)'
handles [9:8] bits. Thus, it should be fixed in order to handle
[5:4] bits.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/watchdog/kempld_wdt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c
index 491419e..5c3d4df 100644
--- a/drivers/watchdog/kempld_wdt.c
+++ b/drivers/watchdog/kempld_wdt.c
@@ -35,7 +35,7 @@
 #define KEMPLD_WDT_STAGE_TIMEOUT(x)	(0x1b + (x) * 4)
 #define KEMPLD_WDT_STAGE_CFG(x)		(0x18 + (x))
 #define STAGE_CFG_GET_PRESCALER(x)	(((x) & 0x30) >> 4)
-#define STAGE_CFG_SET_PRESCALER(x)	(((x) & 0x30) << 4)
+#define STAGE_CFG_SET_PRESCALER(x)	(((x) & 0x3) << 4)
 #define STAGE_CFG_PRESCALER_MASK	0x30
 #define STAGE_CFG_ACTION_MASK		0x7
 #define STAGE_CFG_ASSERT		(1 << 3)
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH RESEND 3/3] watchdog: kempld_wdt: Add __user annotation
  2013-09-23 10:15 [PATCH RESEND 1/3] watchdog: dw_wdt: Add __user annotation Jingoo Han
  2013-09-23 10:16 ` [PATCH RESEND 2/3] watchdog: kempld_wdt: Fix bit mask definition Jingoo Han
@ 2013-09-23 10:17 ` Jingoo Han
  1 sibling, 0 replies; 3+ messages in thread
From: Jingoo Han @ 2013-09-23 10:17 UTC (permalink / raw)
  To: 'Wim Van Sebroeck'
  Cc: linux-watchdog, 'Guenter Roeck', 'Jamie Iles',
	'Kevin Strasser', 'Jingoo Han'

Added __user annotation to fix the following sparse warnings.
Also, it makes 'kempld_prescaler' static because it is used
only in this file.

drivers/watchdog/kempld_wdt.c:70:11: warning: symbol 'kempld_prescaler' was not declared. Should it be static?
drivers/watchdog/kempld_wdt.c:364:23: warning: incorrect type in initializer (different address spaces)
drivers/watchdog/kempld_wdt.c:364:23:    expected int const [noderef] <asn:1>*register __p
drivers/watchdog/kempld_wdt.c:364:23:    got int *<noident>

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/watchdog/kempld_wdt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c
index 5c3d4df..8a8e3ec 100644
--- a/drivers/watchdog/kempld_wdt.c
+++ b/drivers/watchdog/kempld_wdt.c
@@ -67,7 +67,7 @@ enum {
 	PRESCALER_12,
 };
 
-const u32 kempld_prescaler[] = {
+static const u32 kempld_prescaler[] = {
 	[PRESCALER_21] = (1 << 21) - 1,
 	[PRESCALER_17] = (1 << 17) - 1,
 	[PRESCALER_12] = (1 << 12) - 1,
@@ -361,7 +361,7 @@ static long kempld_wdt_ioctl(struct watchdog_device *wdd, unsigned int cmd,
 		ret = kempld_wdt_keepalive(wdd);
 		break;
 	case WDIOC_GETPRETIMEOUT:
-		ret = put_user(wdt_data->pretimeout, (int *)arg);
+		ret = put_user(wdt_data->pretimeout, (int __user *)arg);
 		break;
 	}
 
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-23 10:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-23 10:15 [PATCH RESEND 1/3] watchdog: dw_wdt: Add __user annotation Jingoo Han
2013-09-23 10:16 ` [PATCH RESEND 2/3] watchdog: kempld_wdt: Fix bit mask definition Jingoo Han
2013-09-23 10:17 ` [PATCH RESEND 3/3] watchdog: kempld_wdt: Add __user annotation Jingoo Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).