summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2024-02-13 21:05:01 +0300
committerLaurentiu Palcu <laurentiu.palcu@oss.nxp.com>2024-02-28 09:16:59 +0000
commit9cb3542aeeac31b3dd6b5a7d58b9b7d6fe9fd2bc (patch)
treeb4c47a19a76715a443443f67df369964ed1400cd
parent9fa2679b7fe1bf4e6010051767d3c163b3aee68b (diff)
drm/imx/dcss: fix resource size calculationdrm-misc-next-fixes-2024-02-29
The resource is inclusive of the ->start and ->end addresses so this calculation is not correct. It should be "res->end - res->start + 1". Use the resource_size() to do the calculation. Fixes: 90393c9b5408 ("drm/imx/dcss: request memory region") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com> Link: https://patchwork.freedesktop.org/patch/msgid/4914592b-4256-4c9c-bc1d-6dec1e473831@moroto.mountain
-rw-r--r--drivers/gpu/drm/imx/dcss/dcss-dev.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpu/drm/imx/dcss/dcss-dev.c b/drivers/gpu/drm/imx/dcss/dcss-dev.c
index 597e9b7bd4bf..7fd0c4c14205 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-dev.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-dev.c
@@ -167,7 +167,6 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output)
struct resource *res;
struct dcss_dev *dcss;
const struct dcss_type_data *devtype;
- resource_size_t res_len;
devtype = of_device_get_match_data(dev);
if (!devtype) {
@@ -181,8 +180,7 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output)
return ERR_PTR(-EINVAL);
}
- res_len = res->end - res->start;
- if (!devm_request_mem_region(dev, res->start, res_len, "dcss")) {
+ if (!devm_request_mem_region(dev, res->start, resource_size(res), "dcss")) {
dev_err(dev, "cannot request memory region\n");
return ERR_PTR(-EBUSY);
}