From patchwork Wed Dec 30 15:59:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Insu Yun X-Patchwork-Id: 7939501 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E76489F38D for ; Fri, 1 Jan 2016 14:55:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 276DD20553 for ; Fri, 1 Jan 2016 14:55:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1E5F5205DC for ; Fri, 1 Jan 2016 14:55:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 58B776E3C2; Fri, 1 Jan 2016 06:55:10 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yk0-f173.google.com (mail-yk0-f173.google.com [209.85.160.173]) by gabe.freedesktop.org (Postfix) with ESMTPS id 518176E076; Wed, 30 Dec 2015 07:56:44 -0800 (PST) Received: by mail-yk0-f173.google.com with SMTP id a85so81156516ykb.1; Wed, 30 Dec 2015 07:56:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=eweA1qz3lr1ZriXpq5zgNyZz94cL9XfLwB2ypNneMks=; b=nzLg6OTIG2mbKMGx6MGw9AHQ1zjqKK3If4qN7Xy/Jv5xTmVkllexLVevtUxc0d1BjB Q169T0h3/rRWnaOtRMtuV6O64AXRytB/VTNswuBKFX/YUGf1ZyGal0OUC8QEXpRkLoH6 RHKmDHIBkDZNbxbbcx8E9mlF+YICmIiVaVk9BY41OJ6c8OvSLnPd8awLSqdFtsqVcY4n ha2CwaXrGQe6IS+G0yjPuMoAoFynPaYEi0WY3ToZnClLsoDVfXqNiC6PDt4gJBG3kHvS TJIBZhLbotoEvFV431AsZYiW9xelydOEkeVCehDWEjMnd7THGuKMDhEzObI09wqgXRPU 70mQ== X-Received: by 10.129.145.14 with SMTP id i14mr48861330ywg.174.1451491003509; Wed, 30 Dec 2015 07:56:43 -0800 (PST) Received: from cutthroat.gtisc.gatech.edu (cutthroat.gtisc.gatech.edu. [128.61.240.77]) by smtp.gmail.com with ESMTPSA id i143sm29054512ywg.48.2015.12.30.07.56.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Dec 2015 07:56:43 -0800 (PST) From: Insu Yun To: daniel.vetter@intel.com, jani.nikula@linux.intel.com, airlied@linux.ie, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] i915: correctly handling failed allocation Date: Wed, 30 Dec 2015 10:59:29 -0500 Message-Id: <1451491169-35068-1-git-send-email-wuninsu@gmail.com> X-Mailer: git-send-email 1.9.1 X-Mailman-Approved-At: Fri, 01 Jan 2016 06:55:07 -0800 Cc: yeongjin.jang@gatech.edu, taesoo@gatech.edu, insu@gatech.edu, Insu Yun , changwoo@gatech.edu X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since devm_kzalloc can be failed, it needs to be checked if not, NULL dereference could be happened. Signed-off-by: Insu Yun --- drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c index a5e99ac..aa1f7bc 100644 --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c @@ -666,6 +666,8 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id) /* This is cheating a bit with the cleanup. */ vbt_panel = devm_kzalloc(dev->dev, sizeof(*vbt_panel), GFP_KERNEL); + if (!vbt_panel) + return NULL; vbt_panel->intel_dsi = intel_dsi; drm_panel_init(&vbt_panel->panel);