lkml.org 
[lkml]   [2009]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/5] drivers/clocksource: correct size computation
From: Julia Lawall <julia@diku.dk>

The size argument to ioremap_nocache should be the size of desired
information, not the pointer to it.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression *x;
@@

x =
<+...
-sizeof(x)
+sizeof(*x)
...+>// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
drivers/clocksource/cyclone.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff -u -p a/drivers/clocksource/cyclone.c b/drivers/clocksource/cyclone.c
--- a/drivers/clocksource/cyclone.c
+++ b/drivers/clocksource/cyclone.c
@@ -50,7 +50,7 @@ static int __init init_cyclone_clocksour

/* find base address: */
offset = CYCLONE_CBAR_ADDR;
- reg = ioremap_nocache(offset, sizeof(reg));
+ reg = ioremap_nocache(offset, sizeof(*reg));
if (!reg) {
printk(KERN_ERR "Summit chipset: Could not find valid CBAR register.\n");
return -ENODEV;
@@ -65,7 +65,7 @@ static int __init init_cyclone_clocksour

/* setup PMCC: */
offset = base + CYCLONE_PMCC_OFFSET;
- reg = ioremap_nocache(offset, sizeof(reg));
+ reg = ioremap_nocache(offset, sizeof(*reg));
if (!reg) {
printk(KERN_ERR "Summit chipset: Could not find valid PMCC register.\n");
return -ENODEV;
@@ -75,7 +75,7 @@ static int __init init_cyclone_clocksour

/* setup MPCS: */
offset = base + CYCLONE_MPCS_OFFSET;
- reg = ioremap_nocache(offset, sizeof(reg));
+ reg = ioremap_nocache(offset, sizeof(*reg));
if (!reg) {
printk(KERN_ERR "Summit chipset: Could not find valid MPCS register.\n");
return -ENODEV;

\
 
 \ /
  Last update: 2009-12-06 10:19    [W:0.051 / U:15.564 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site