summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-04-25 12:04:54 +0300
committerBoris Brezillon <boris.brezillon@free-electrons.com>2016-06-01 15:59:36 +0200
commit58a2ab3af722550b2e4e8155eb08660e16c20ee6 (patch)
tree5685d16d65ee605b438678179238303128a964da
parentc2e4c99444f418b3c3b13b58dad4d951aa2f7f1b (diff)
downloadop-kernel-dev-58a2ab3af722550b2e4e8155eb08660e16c20ee6.zip
op-kernel-dev-58a2ab3af722550b2e4e8155eb08660e16c20ee6.tar.gz
drm: atmel-hlcdc: fix a NULL check
If kmalloc() returned NULL we would end up dereferencing "state" a couple lines later. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
-rw-r--r--drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
index ac4e063..bd12231 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
@@ -414,8 +414,9 @@ atmel_hlcdc_crtc_duplicate_state(struct drm_crtc *crtc)
return NULL;
state = kmalloc(sizeof(*state), GFP_KERNEL);
- if (state)
- __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
+ if (!state)
+ return NULL;
+ __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
cur = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state);
state->output_mode = cur->output_mode;
OpenPOWER on IntegriCloud