Skip to content

Commit 589b648

Browse files
pcornuBenjamin-Gaignard
authored andcommitted
drm/stm: ltdc: add devm_reset_control & platform_get_ressource
Use devm_reset_control_get_exclusive to avoid resource leakage (based on patch "Convert drivers to explicit reset API" from Philipp Zabel). Also use platform_get_resource, which is more usual and consistent with platform_get_irq called later. Signed-off-by: Fabien Dessenne <[email protected]> Signed-off-by: Philippe CORNU <[email protected]> Reviewed-by: Benjamin Gaignard <[email protected]> Cc: Philipp Zabel <[email protected]> Signed-off-by: Benjamin Gaignard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent c994796 commit 589b648

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/gpu/drm/stm/ltdc.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ int ltdc_load(struct drm_device *ddev)
874874
struct drm_panel *panel;
875875
struct drm_crtc *crtc;
876876
struct reset_control *rstc;
877-
struct resource res;
877+
struct resource *res;
878878
int irq, ret, i;
879879

880880
DRM_DEBUG_DRIVER("\n");
@@ -883,7 +883,7 @@ int ltdc_load(struct drm_device *ddev)
883883
if (ret)
884884
return ret;
885885

886-
rstc = of_reset_control_get(np, NULL);
886+
rstc = devm_reset_control_get_exclusive(dev, NULL);
887887

888888
mutex_init(&ldev->err_lock);
889889

@@ -898,13 +898,14 @@ int ltdc_load(struct drm_device *ddev)
898898
return -ENODEV;
899899
}
900900

901-
if (of_address_to_resource(np, 0, &res)) {
901+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
902+
if (!res) {
902903
DRM_ERROR("Unable to get resource\n");
903904
ret = -ENODEV;
904905
goto err;
905906
}
906907

907-
ldev->regs = devm_ioremap_resource(dev, &res);
908+
ldev->regs = devm_ioremap_resource(dev, res);
908909
if (IS_ERR(ldev->regs)) {
909910
DRM_ERROR("Unable to get ltdc registers\n");
910911
ret = PTR_ERR(ldev->regs);

0 commit comments

Comments
 (0)