Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH 2/5] drivers/clocksource: correct size computation

0 views
Skip to first unread message

Julia Lawall

unread,
Dec 6, 2009, 4:20:03 AM12/6/09
to
From: Julia Lawall <ju...@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 <ju...@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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

0 new messages