Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp953753imm; Fri, 5 Oct 2018 15:01:56 -0700 (PDT) X-Google-Smtp-Source: ACcGV605OnO1K6UN7uLcw4nENCQtUd6znbU/o/71gvjomDvRi8OHiK41ZAvQxuyZli4seqrzz/u6 X-Received: by 2002:a63:d502:: with SMTP id c2-v6mr11793357pgg.324.1538776916343; Fri, 05 Oct 2018 15:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538776916; cv=none; d=google.com; s=arc-20160816; b=rt7EtV0KTfstaQYvNVAJMCfJuv5a3R6+i9755/iiGM2psouqQwiVM17A3roa7OOuP+ 4H3gv86vpuK5ERk8EBYMOc6USYtHpDFde8iy7dpyhFwrXuUn63UJ/MgyTug7hdkrrhPI 2oDTB037FikLJrpmJdMEQ2DkXpQFjErK1BIfZAMSyrWswvONpYJnGMRmcb3V9cRHCH1y kfQLqzVVSOwrW6OYqNvRxPOQkSIsLZCPWoO7lEHhqGq4lNUixf9GPVZLp0wZB8xHsuwb +AC8OlgO8S3JVbIuAqkbfeUnZV+r0Py+kxuFrgW8YuUBpwrA1j+A8zV8/hF5qdWGxZz6 pWcg== 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=/5AYk56auw3gzlDPLJ3CEN7C/uxbVOrcMFGuS0V1JrU=; b=hd6pr9hmhq+JUu4S193yYv98DyqDLB5fcMuhSQeeulNh03xEc0XIjinBnlk3eAZn74 dKmwZ63onayHm2ocus2F0C6DGoolTGZ4Do7B10TvMYOX0dKhj0qwImh9m2LYvcIUNsAq QhtijDHN0aNevbzrmQni1ySVIqscPZATfSrvxdq7KOCb91DziHbyiue0ciT0NwbEjvjT ng+jH63GMAXiknFx2VNUNphsg61fa6kCNgwXYCGEiYDBRJ2n0O72qurAR5TnQY6mbESC QH/qCxSR0Dx5S357keuexYUUHJrnGMaN7bXg+9sBZIW7rT+WHZlfA7Qlg8bfCSJYvAhq acrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=W13CNmK1; 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 w71-v6si8761428pgd.163.2018.10.05.15.01.40; Fri, 05 Oct 2018 15:01:56 -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=W13CNmK1; 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 S1727317AbeJFFAg (ORCPT + 99 others); Sat, 6 Oct 2018 01:00:36 -0400 Received: from mail.micronovasrl.com ([212.103.203.10]:45174 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725772AbeJFFAg (ORCPT ); Sat, 6 Oct 2018 01:00:36 -0400 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id C8D0BB0081B for ; Fri, 5 Oct 2018 23:59:55 +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=1538776795; x=1539640796; bh=6I LxoHv50N8w16qw34Fi8S7zwu/gJ947bOekxAMNcUc=; b=W13CNmK13Lrc0OU+4M Rr4snk15NJ7/P/QnRRYTTWLh6GaqD7y7LncrvX5ScA2XOQXjn5IGWIf+egs4qoFZ UV3ExKyK6tMju8osUyKWcIoka3ZDOSuwN/2ikv18rN6Oj+65mdWBXmzqpbcSwgF/ BTKWxYojp9TuwKPOQlO6oL1OE= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9] 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 alGUDreIOXoC for ; Fri, 5 Oct 2018 23:59:55 +0200 (CEST) Received: from ubuntu.localdomain (unknown [192.168.123.60]) by mail.micronovasrl.com (Postfix) with ESMTPSA id BB698B000F6; Fri, 5 Oct 2018 23:59:53 +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 v3 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer Date: Fri, 5 Oct 2018 23:59:50 +0200 Message-Id: <20181005215951.99003-1-giulio.benetti@micronovasrl.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181004195605.txvbkshvxklyzxyb@flea> References: <20181004195605.txvbkshvxklyzxyb@flea> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since tcon->panel is a pointer returned by of_drm_find_panel() need to check if it is not NULL, hence a valid pointer. IS_ERR() instead checks return error values, not NULL pointers. Substitute "if (!IS_ERR(tcon->panel))" with "if (tcon->panel)". Signed-off-by: Giulio Benetti --- Changes V1->V2: * correct same bug for all same occurences in drm/sun4i folder Changes V2->V3: * Improve commit log 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