diff options
| author | Tomi Valkeinen <[email protected]> | 2018-05-02 09:11:59 +0000 |
|---|---|---|
| committer | Sean Paul <[email protected]> | 2018-05-07 14:19:12 +0000 |
| commit | 47aaaec818dfd1009d1358974a2931f05dd57203 (patch) | |
| tree | 3e5a98dd92c29823bac34880ab83dc3c45a0618f /drivers/gpu/drm/omapdrm/omap_connector.c | |
| parent | drm/omap: add missing linefeeds to prints (diff) | |
| download | kernel-47aaaec818dfd1009d1358974a2931f05dd57203.tar.gz kernel-47aaaec818dfd1009d1358974a2931f05dd57203.zip | |
drm/omap: handle alloc failures in omap_connector
Handle memory allocation failures in omap_connector to avoid NULL
derefs.
Signed-off-by: Tomi Valkeinen <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Reviewed-by: Benoit Parrot <[email protected]>
Reviewed-by: Peter Ujfalusi <[email protected]>
Signed-off-by: Sean Paul <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_connector.c')
| -rw-r--r-- | drivers/gpu/drm/omapdrm/omap_connector.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c index a0d7b1d905e8..5cde26ac937b 100644 --- a/drivers/gpu/drm/omapdrm/omap_connector.c +++ b/drivers/gpu/drm/omapdrm/omap_connector.c @@ -121,6 +121,9 @@ static int omap_connector_get_modes(struct drm_connector *connector) if (dssdrv->read_edid) { void *edid = kzalloc(MAX_EDID, GFP_KERNEL); + if (!edid) + return 0; + if ((dssdrv->read_edid(dssdev, edid, MAX_EDID) > 0) && drm_edid_is_valid(edid)) { drm_mode_connector_update_edid_property( @@ -139,6 +142,9 @@ static int omap_connector_get_modes(struct drm_connector *connector) struct drm_display_mode *mode = drm_mode_create(dev); struct videomode vm = {0}; + if (!mode) + return 0; + dssdrv->get_timings(dssdev, &vm); drm_display_mode_from_videomode(&vm, mode); @@ -200,6 +206,10 @@ static int omap_connector_mode_valid(struct drm_connector *connector, if (!r) { /* check if vrefresh is still valid */ new_mode = drm_mode_duplicate(dev, mode); + + if (!new_mode) + return MODE_BAD; + new_mode->clock = vm.pixelclock / 1000; new_mode->vrefresh = 0; if (mode->vrefresh == drm_mode_vrefresh(new_mode)) |
