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 <fabien.dessenne@st.com> Signed-off-by: Philippe CORNU <philippe.cornu@st.com> Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Cc: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/1500552357-29487-6-git-send-email-philippe.cornu@st.com
This commit is contained in:
parent
c994796f64
commit
589b648223
|
@ -874,7 +874,7 @@ int ltdc_load(struct drm_device *ddev)
|
||||||
struct drm_panel *panel;
|
struct drm_panel *panel;
|
||||||
struct drm_crtc *crtc;
|
struct drm_crtc *crtc;
|
||||||
struct reset_control *rstc;
|
struct reset_control *rstc;
|
||||||
struct resource res;
|
struct resource *res;
|
||||||
int irq, ret, i;
|
int irq, ret, i;
|
||||||
|
|
||||||
DRM_DEBUG_DRIVER("\n");
|
DRM_DEBUG_DRIVER("\n");
|
||||||
|
@ -883,7 +883,7 @@ int ltdc_load(struct drm_device *ddev)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
rstc = of_reset_control_get(np, NULL);
|
rstc = devm_reset_control_get_exclusive(dev, NULL);
|
||||||
|
|
||||||
mutex_init(&ldev->err_lock);
|
mutex_init(&ldev->err_lock);
|
||||||
|
|
||||||
|
@ -898,13 +898,14 @@ int ltdc_load(struct drm_device *ddev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (of_address_to_resource(np, 0, &res)) {
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
|
if (!res) {
|
||||||
DRM_ERROR("Unable to get resource\n");
|
DRM_ERROR("Unable to get resource\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
ldev->regs = devm_ioremap_resource(dev, &res);
|
ldev->regs = devm_ioremap_resource(dev, res);
|
||||||
if (IS_ERR(ldev->regs)) {
|
if (IS_ERR(ldev->regs)) {
|
||||||
DRM_ERROR("Unable to get ltdc registers\n");
|
DRM_ERROR("Unable to get ltdc registers\n");
|
||||||
ret = PTR_ERR(ldev->regs);
|
ret = PTR_ERR(ldev->regs);
|
||||||
|
|
Loading…
Reference in a new issue