From patchwork Tue Oct 2 20:48:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giulio Benetti X-Patchwork-Id: 10624019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3BB1816B1 for ; Tue, 2 Oct 2018 20:49:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F596271CB for ; Tue, 2 Oct 2018 20:49:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1215A27861; Tue, 2 Oct 2018 20:49:50 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 8681F271CB for ; Tue, 2 Oct 2018 20:49:49 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=MZw7kghYto8K6qsKXax5rBEn5t+HGt3v66FycuwzzPI=; b=HK1xLi1Lf8fbJ6+nf145kUpjGK 6HohTc6FoZ544BjTH2l4RkOHFJOA6SQLEzOpwyr9y+543US0B0OTyHkpk41ghknIzr+XskIQVxaHs 6lI4WgsJrAJh8w/UhcTUV3J3UGUPyAzWS1XzbVEauFmFbhlsD1oY4ZKmg7jBfJoLbEMPkE0dkb9qr 04XrBuxXsKNEk46KfwlyF/aw1NqKPb9JFTrfjfVvQE7YyB8R0T/CoHwLOFfPvodipnIFJk0fm05KC TYB4H3UgWKojY4uHnZN3/QwE8H99U0kLSK1qwGkGzqtW/Ib00qq2BGq9hv37zn0TPVobjn6PubPJV RIpjPdGA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7Rbn-0005tV-9Y; Tue, 02 Oct 2018 20:49:31 +0000 Received: from mail.micronovasrl.com ([212.103.203.10]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7Rbh-0005qm-TE for linux-arm-kernel@lists.infradead.org; Tue, 02 Oct 2018 20:49:27 +0000 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 5AA6FB00BA8 for ; Tue, 2 Oct 2018 22:49:04 +0200 (CEST) Authentication-Results: mail.micronovasrl.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=micronovasrl.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com; h=references:in-reply-to:x-mailer:message-id:date:date:subject :subject:to:from:from; s=dkim; t=1538513343; x=1539377344; bh=0a zMu6Ww48q352jv+MAfjeImAqkhQeep+ozCDFqNfv8=; b=IqN8RKyC2OmkbT0Y29 fV9HT2AAv2h0j8vm/Gygm7JE1YqZqc7uGCLcz+IxlEKpdz4HUd+79+9IBhK/7Rzg 50Z9FFxekDwx+tShp07XBKdzkpCXd2psc/zLH/KYTgWP//x6Kwu/AvSjfZ5/Bve7 zdeQ77RsWGiaUmgXwzAc+tUI8= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com Received: from mail.micronovasrl.com ([127.0.0.1]) by mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id UYxxhvWZu0Gz for ; Tue, 2 Oct 2018 22:49:03 +0200 (CEST) Received: from ubuntu.localdomain (146-241-101-147.dyn.eolo.it [146.241.101.147]) by mail.micronovasrl.com (Postfix) with ESMTPSA id D3145B00765; Tue, 2 Oct 2018 22:49:02 +0200 (CEST) From: Giulio Benetti To: Maxime Ripard Subject: [PATCH 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer Date: Tue, 2 Oct 2018 22:48:59 +0200 Message-Id: <20181002204900.82118-1-giulio.benetti@micronovasrl.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181001093612.GA13672@mwanda> References: <20181001093612.GA13672@mwanda> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181002_134926_138904_169EAC15 X-CRM114-Status: GOOD ( 26.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, Giulio Benetti , Dan Carpenter MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP At the moment, the check of tcon->panel to be valid is wrong. IS_ERR() has been used, but that macro doesn't check if tcon->panel pointer is null or not, but check if tcon->panel is between -1 and -4095(MAX_ERRNO). Remove IS_ERR() from tcon->panel checking and let "if (tcon->panel)" as condition to check if it's a pointer not null. Signed-off-by: Giulio Benetti --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index c78cd35a1294..e4b3bd0307ef 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -555,7 +555,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, * Following code is a way to avoid quirks all around TCON * and DOTCLOCK drivers. */ - if (!IS_ERR(tcon->panel)) { + if (tcon->panel) { struct drm_panel *panel = tcon->panel; struct drm_connector *connector = panel->connector; struct drm_display_info display_info = connector->display_info;