From patchwork Thu Jul 6 21:58:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 9829079 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 15AAF602BD for ; Thu, 6 Jul 2017 21:59:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 081EF283DA for ; Thu, 6 Jul 2017 21:59:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F082A28504; Thu, 6 Jul 2017 21:59:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7693728429 for ; Thu, 6 Jul 2017 21:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=HXmmP+apkad1GKsNXys9rZRzS9e0lQ+los3FO6Ia6CA=; b=tOSRGkO5n2nSzV Ob5AYu342OtMaVrTePY9LoCQksdiOVuh/3Q7GGzZnytmX2lobfWLjUj5X3wwT8AJg2IVYIv1DZ3uY K/6ftLbFn8nGkMG3SUOljAsN3+Hht+pKlMkysVtbmjflai64862Um65GixF5fwF6AcCX/Dfoa5d/w Sm051FL6WY9Sy6pVfQYFDSphsw0H/EGocu4EgPRUFpdVXGOhP6DDO8HpFZn4LjEXErcHPDEW2JcrI YqC751Jt6r036yExFei+GC4cxJEq5blKZjqfS+gYrX5uRCBHjL2j1HyZfYrygyLFXfELFqMV7jGH0 FpLQJjwTbMYea7D6hn3A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dTEnf-0006Kp-Kw; Thu, 06 Jul 2017 21:59:03 +0000 Received: from gateway31.websitewelcome.com ([192.185.144.94]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dTEna-0006BO-UR for linux-rockchip@lists.infradead.org; Thu, 06 Jul 2017 21:59:00 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway31.websitewelcome.com (Postfix) with ESMTP id CDA3C262D1B for ; Thu, 6 Jul 2017 16:58:34 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id TEmpdBvkpUWWCTEmpdhXuJ; Thu, 06 Jul 2017 16:58:11 -0500 Received: from [189.152.196.165] (port=38064 helo=embeddedgus) by gator4166.hostgator.com with esmtpa (Exim 4.87) (envelope-from ) id 1dTEnC-000x3N-Gs; Thu, 06 Jul 2017 16:58:34 -0500 Date: Thu, 6 Jul 2017 16:58:33 -0500 From: "Gustavo A. R. Silva" To: Mark Yao , David Airlie , Heiko Stuebner Subject: [PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return value Message-ID: <20170706215833.GA25411@embeddedgus> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.152.196.165 X-Exim-ID: 1dTEnC-000x3N-Gs X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedgus) [189.152.196.165]:38064 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 14 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170706_145859_084791_41ACA2C9 X-CRM114-Status: UNSURE ( 5.58 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, "Gustavo A. R. Silva" , linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The right variable to check here is port, not dp. This issue was detected using Coccinelle and the following semantic patch: @@ expression x; identifier fld; @@ * x = devm_kzalloc(...); ... when != x == NULL x->fld Signed-off-by: Gustavo A. R. Silva Acked-by: Mark Yao --- drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index 14fa1f8..9b0b058 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -1195,7 +1195,7 @@ static int cdn_dp_probe(struct platform_device *pdev) continue; port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); - if (!dp) + if (!port) return -ENOMEM; port->extcon = extcon;