Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751372AbcLCJSn (ORCPT ); Sat, 3 Dec 2016 04:18:43 -0500 Received: from m50-135.163.com ([123.125.50.135]:44018 "EHLO m50-135.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750745AbcLCJSk (ORCPT ); Sat, 3 Dec 2016 04:18:40 -0500 X-Greylist: delayed 66367 seconds by postgrey-1.27 at vger.kernel.org; Sat, 03 Dec 2016 04:18:37 EST From: Pan Bian To: Eric Anholt , David Airlie , dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH 1/1] dri: vc4: set error code on failure Date: Sat, 3 Dec 2016 17:17:27 +0800 Message-Id: <1480756647-3673-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: D9GowADXIOKmjUJYCRKAIA--.32467S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrZFW7XFWkKryDZF15Kr1xZrb_yoWfWrb_u3 W8XrZ7ZrWFkF1kJFy2kw4IqryIkry5ZF4vyr1aqa4ftFy7ua4UA3s2qr1DXw17uFn2yFyD Cwn3XFn8ArsrGjkaLaAFLSUrUUUU0b8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU5knY7UUUUU== X-Originating-IP: [222.131.246.88] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/1tbiVAk1clUL+mpv1QAAsu Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 846 Lines: 26 Function vc4_cl_lookup_bos() does not set the error code when drm_malloc_ab() returns a NULL pointer, and will return 0 (indicates success). This patch fixes the bug, assigning "-ENOMEM" to the return variable ret on the path that memory allocation fails. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188631 Signed-off-by: Pan Bian --- drivers/gpu/drm/vc4/vc4_gem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c index 47a095f..2592a94 100644 --- a/drivers/gpu/drm/vc4/vc4_gem.c +++ b/drivers/gpu/drm/vc4/vc4_gem.c @@ -544,6 +544,7 @@ struct vc4_hang_state { handles = drm_malloc_ab(exec->bo_count, sizeof(uint32_t)); if (!handles) { + ret = -ENOMEM; DRM_ERROR("Failed to allocate incoming GEM handles\n"); goto fail; } -- 1.9.1