Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2666856imm; Wed, 3 Oct 2018 07:26:16 -0700 (PDT) X-Google-Smtp-Source: ACcGV61+agZZ0tA4q2isgyeSsa5gg6yWmCkyjIRSFS65hk40S+YM1NDGOZAx4fHdPLdoa9tWLuz6 X-Received: by 2002:a62:76d8:: with SMTP id r207-v6mr1914116pfc.216.1538576776938; Wed, 03 Oct 2018 07:26:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538576776; cv=none; d=google.com; s=arc-20160816; b=W8oihFahehsYh2/Wy4VZZMTtbts1A85L9IkU1I04zdgzAqsoGkJHrxVKSBGWXGNAJb R1J/Qzg4oD9Orl4Huj9ng0ffx0XtE+OVZcjf/iMRunYpQl9cEBUs6ckI5jXHNiDqv7Ke vU4SXNg4sqhU7vq1bQHTqPDtU/YVoZBvknElItbUSSh6cTvhBfJO6KHMtBuMDimos8vp hnmJWDavejNcWrC+aFgkLUqMVtvkR0OQnaSdWECT84z0Uir1Qd3i88Q/ilEzEnhA16mT wWa5s0sK+WoExEXb5fKwjlWda5Z96v2lH+twR2YGhHxSDrakgHY+9Zea+TCW1Kys9lJI knOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=QdojA3Vmr6zcBDm/kI3hRWE4JfP0rTMvKwCexygW6Ek=; b=LwyfiQlcOeLnWj7XkOXuz358E76SfnNfYlpMdRMOng0mUrhSDsiXAIG3NErZqUwdQa O2/dd38PuQoq2br6H8lyojOC/BVDRO+aHDM4WJD/9/dZVPwUY0rqVn41VIS6poWcwnik lTRbuCGNvygimwxQLEl8NHuTwJsBLC0v+sIOVP1iLAEklvzOKOZl1WHduYoaIdMbqTQx Cxc2x9qVrzpZF4/QG5fhIYwOPhYdPR/vrgO7Pu/VoW52vLMR80Voa7v5woUEcqvgb5br 5yWMae5If0NjJ4scn7FChRl6ZTVP9Yd/WXLmvGNMWmPubl4Y1mHPLFGuo75A5GfVJDX5 xaag== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=EKfdmVAz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 140-v6si2130745pfb.41.2018.10.03.07.26.01; Wed, 03 Oct 2018 07:26:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=EKfdmVAz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbeJCVNw (ORCPT + 99 others); Wed, 3 Oct 2018 17:13:52 -0400 Received: from mail.micronovasrl.com ([212.103.203.10]:37084 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726543AbeJCVNw (ORCPT ); Wed, 3 Oct 2018 17:13:52 -0400 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 3874DB013EE for ; Wed, 3 Oct 2018 16:25:14 +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=1538576712; x=1539440713; bh=Lj KnGJP4TdCoWqibBRvqHzphJU2fsqMvq+PH3cAGiTE=; b=EKfdmVAzJAiLFzcAnR 5RNSXkc5jhJHf6exjEcpuQm+K7uIycLWppXu9NNKlZp4nIEv5cMXGRBqNc6Dq0/1 TzMKUJTpBLcQwJg2daIm3drLHGLv69+JFljSh81l85T4sz0K0pDr7QT5I1sWkf3G wxO1S9HOKofeeYISlWo02uwec= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com X-Spam-Flag: NO X-Spam-Score: -2.899 X-Spam-Level: X-Spam-Status: No, score=-2.899 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no 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 soziho1xZPgT for ; Wed, 3 Oct 2018 16:25:12 +0200 (CEST) Received: from localhost.localdomain (host128-8-dynamic.21-79-r.retail.telecomitalia.it [79.21.8.128]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 680BDB00245; Wed, 3 Oct 2018 16:25:11 +0200 (CEST) From: Giulio Benetti To: Maxime Ripard Cc: David Airlie , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Giulio Benetti Subject: [PATCH v2 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer Date: Wed, 3 Oct 2018 16:24:57 +0200 Message-Id: <20181003142458.33120-1-giulio.benetti@micronovasrl.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <9a545739-eed5-7af1-3b75-108bdd3427a2@micronovasrl.com> References: <9a545739-eed5-7af1-3b75-108bdd3427a2@micronovasrl.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes V1->V2: * correct same bug for all same occurences in drm/sun4i folder drivers/gpu/drm/sun4i/sun4i_lvds.c | 4 ++-- drivers/gpu/drm/sun4i/sun4i_rgb.c | 4 ++-- drivers/gpu/drm/sun4i/sun4i_tcon.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_lvds.c b/drivers/gpu/drm/sun4i/sun4i_lvds.c index af7dcb6da351..e7eb0d1e17be 100644 --- a/drivers/gpu/drm/sun4i/sun4i_lvds.c +++ b/drivers/gpu/drm/sun4i/sun4i_lvds.c @@ -75,7 +75,7 @@ static void sun4i_lvds_encoder_enable(struct drm_encoder *encoder) DRM_DEBUG_DRIVER("Enabling LVDS output\n"); - if (!IS_ERR(tcon->panel)) { + if (tcon->panel) { drm_panel_prepare(tcon->panel); drm_panel_enable(tcon->panel); } @@ -88,7 +88,7 @@ static void sun4i_lvds_encoder_disable(struct drm_encoder *encoder) DRM_DEBUG_DRIVER("Disabling LVDS output\n"); - if (!IS_ERR(tcon->panel)) { + if (tcon->panel) { drm_panel_disable(tcon->panel); drm_panel_unprepare(tcon->panel); } diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c index bf068da6b12e..f4a22689eb54 100644 --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c @@ -135,7 +135,7 @@ static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder) DRM_DEBUG_DRIVER("Enabling RGB output\n"); - if (!IS_ERR(tcon->panel)) { + if (tcon->panel) { drm_panel_prepare(tcon->panel); drm_panel_enable(tcon->panel); } @@ -148,7 +148,7 @@ static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder) DRM_DEBUG_DRIVER("Disabling RGB output\n"); - if (!IS_ERR(tcon->panel)) { + if (tcon->panel) { drm_panel_disable(tcon->panel); drm_panel_unprepare(tcon->panel); } 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; -- 2.17.1