From: Tomeu Vizoso Date: Thu, 9 May 2019 08:21:51 +0000 (+0200) Subject: drm/panfrost: Only put sync_out if non-NULL X-Git-Tag: v5.4-rc1~498^2~9^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc2e787ee7c2c00698bb84a3da4adb3a84187e67;p=platform%2Fkernel%2Flinux-rpi.git drm/panfrost: Only put sync_out if non-NULL Dan Carpenter's static analysis tool reported: drivers/gpu/drm/panfrost/panfrost_drv.c:222 panfrost_ioctl_submit() error: we previously assumed 'sync_out' could be null (see line 216) Indeed, sync_out could be NULL if userspace doesn't send a sync object ID for the out fence. Signed-off-by: Tomeu Vizoso Reported-by: Dan Carpenter Link: https://lists.freedesktop.org/archives/dri-devel/2019-May/217014.html Reviewed-by: Steven Price Signed-off-by: Rob Herring Link: https://patchwork.freedesktop.org/patch/msgid/20190509082151.8823-1-tomeu.vizoso@collabora.com --- diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index 94b0819..d11e228 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -219,7 +219,8 @@ static int panfrost_ioctl_submit(struct drm_device *dev, void *data, fail_job: panfrost_job_put(job); fail_out_sync: - drm_syncobj_put(sync_out); + if (sync_out) + drm_syncobj_put(sync_out); return ret; }