Commit c0c72a85 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Dave Airlie

drm: shmob_drm: Check clk_prepare_enable() return value

The clk_prepare_enable() call can fail. Check it's return value. We
can't propagate it all the way to the user as the KMS operations in
which the clock is enabled return a void.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 66ee52e2
...@@ -37,14 +37,21 @@ ...@@ -37,14 +37,21 @@
* Clock management * Clock management
*/ */
static void shmob_drm_clk_on(struct shmob_drm_device *sdev) static int shmob_drm_clk_on(struct shmob_drm_device *sdev)
{ {
if (sdev->clock) int ret;
clk_prepare_enable(sdev->clock);
if (sdev->clock) {
ret = clk_prepare_enable(sdev->clock);
if (ret < 0)
return ret;
}
#if 0 #if 0
if (sdev->meram_dev && sdev->meram_dev->pdev) if (sdev->meram_dev && sdev->meram_dev->pdev)
pm_runtime_get_sync(&sdev->meram_dev->pdev->dev); pm_runtime_get_sync(&sdev->meram_dev->pdev->dev);
#endif #endif
return 0;
} }
static void shmob_drm_clk_off(struct shmob_drm_device *sdev) static void shmob_drm_clk_off(struct shmob_drm_device *sdev)
...@@ -161,6 +168,7 @@ static void shmob_drm_crtc_start(struct shmob_drm_crtc *scrtc) ...@@ -161,6 +168,7 @@ static void shmob_drm_crtc_start(struct shmob_drm_crtc *scrtc)
struct drm_device *dev = sdev->ddev; struct drm_device *dev = sdev->ddev;
struct drm_plane *plane; struct drm_plane *plane;
u32 value; u32 value;
int ret;
if (scrtc->started) if (scrtc->started)
return; return;
...@@ -170,7 +178,9 @@ static void shmob_drm_crtc_start(struct shmob_drm_crtc *scrtc) ...@@ -170,7 +178,9 @@ static void shmob_drm_crtc_start(struct shmob_drm_crtc *scrtc)
return; return;
/* Enable clocks before accessing the hardware. */ /* Enable clocks before accessing the hardware. */
shmob_drm_clk_on(sdev); ret = shmob_drm_clk_on(sdev);
if (ret < 0)
return;
/* Reset and enable the LCDC. */ /* Reset and enable the LCDC. */
lcdc_write(sdev, LDCNT2R, lcdc_read(sdev, LDCNT2R) | LDCNT2R_BR); lcdc_write(sdev, LDCNT2R, lcdc_read(sdev, LDCNT2R) | LDCNT2R_BR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment