mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
staging: kpc2000: fix resource size calculation
The code is calculating the resource size wrong because it should be
inclusive of the "res->end" address. In other words, "end - start + 1".
We can just use the resource_size() function to do it correctly.
Fixes: 7dc7967fc3
("staging: kpc2000: add initial set of Daktronics drivers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d687bdefba
commit
f998a1180e
@ -632,7 +632,7 @@ int pi2c_probe(struct platform_device *pldev)
|
||||
priv->adapter.algo = &smbus_algorithm;
|
||||
|
||||
res = platform_get_resource(pldev, IORESOURCE_MEM, 0);
|
||||
priv->smba = (unsigned long)ioremap_nocache(res->start, res->end - res->start);
|
||||
priv->smba = (unsigned long)ioremap_nocache(res->start, resource_size(res));
|
||||
|
||||
priv->pldev = pldev;
|
||||
pldev->dev.platform_data = priv;
|
||||
|
@ -452,7 +452,7 @@ kp_spi_probe(struct platform_device *pldev)
|
||||
goto free_master;
|
||||
}
|
||||
|
||||
kpspi->phys = (unsigned long)ioremap_nocache(r->start, r->end - r->start);
|
||||
kpspi->phys = (unsigned long)ioremap_nocache(r->start, resource_size(r));
|
||||
kpspi->base = (u64 __iomem *)kpspi->phys;
|
||||
|
||||
status = spi_register_master(master);
|
||||
|
Loading…
Reference in New Issue
Block a user