diff options
author | Julia Lawall <julia@diku.dk> | 2009-07-08 01:04:55 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-07-08 01:48:14 -0400 |
commit | 72398e4b1a4cf55d3698a4f265b638093a470b04 (patch) | |
tree | 497fd88ccf5d3984b9585f52139e2e3b35bf8798 /drivers/input/misc | |
parent | 666cbe342622c959ad95515918a1c1f8210c93f2 (diff) |
Input: use resource_size when allocating resources
Use the function resource_size, which reduces the chance of
introducing off-by-one errors in calculating the resource size.
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@@
struct resource *res;
@@
- (res->end - res->start) + 1
+ resource_size(res)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/misc')
-rw-r--r-- | drivers/input/misc/cobalt_btns.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/input/misc/cobalt_btns.c b/drivers/input/misc/cobalt_btns.c index 2adf9cb265da..d01da9bd5da4 100644 --- a/drivers/input/misc/cobalt_btns.c +++ b/drivers/input/misc/cobalt_btns.c | |||
@@ -116,7 +116,7 @@ static int __devinit cobalt_buttons_probe(struct platform_device *pdev) | |||
116 | } | 116 | } |
117 | 117 | ||
118 | bdev->poll_dev = poll_dev; | 118 | bdev->poll_dev = poll_dev; |
119 | bdev->reg = ioremap(res->start, res->end - res->start + 1); | 119 | bdev->reg = ioremap(res->start, resource_size(res)); |
120 | dev_set_drvdata(&pdev->dev, bdev); | 120 | dev_set_drvdata(&pdev->dev, bdev); |
121 | 121 | ||
122 | error = input_register_polled_device(poll_dev); | 122 | error = input_register_polled_device(poll_dev); |