Skip to content

Commit 9cb3542

Browse files
Dan CarpenterLaurentiu Palcu
authored andcommitted
drm/imx/dcss: fix resource size calculation
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: 90393c9 ("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
1 parent 9fa2679 commit 9cb3542

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/gpu/drm/imx/dcss/dcss-dev.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output)
167167
struct resource *res;
168168
struct dcss_dev *dcss;
169169
const struct dcss_type_data *devtype;
170-
resource_size_t res_len;
171170

172171
devtype = of_device_get_match_data(dev);
173172
if (!devtype) {
@@ -181,8 +180,7 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output)
181180
return ERR_PTR(-EINVAL);
182181
}
183182

184-
res_len = res->end - res->start;
185-
if (!devm_request_mem_region(dev, res->start, res_len, "dcss")) {
183+
if (!devm_request_mem_region(dev, res->start, resource_size(res), "dcss")) {
186184
dev_err(dev, "cannot request memory region\n");
187185
return ERR_PTR(-EBUSY);
188186
}

0 commit comments

Comments
 (0)