From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FCDDC33CA3 for ; Fri, 10 Jan 2020 06:20:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F95920673 for ; Fri, 10 Jan 2020 06:20:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="C1L+sKks" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F95920673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 057B26E98C; Fri, 10 Jan 2020 06:19:59 +0000 (UTC) Received: from mailgw01.mediatek.com (unknown [210.61.82.183]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E8346E98C for ; Fri, 10 Jan 2020 06:19:57 +0000 (UTC) X-UUID: 8ca12080878f42b4a5f4715cd583c413-20200110 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=2hX33a9oKQvAaZtJ3NQ0cW54cICk0Docx++JIfjlN54=; b=C1L+sKksrUCaSk1L4aeeOVIVRwEj1HUrt9aleg63TRWpo7VBpUS81ERuh3PNSUunD9Xu1wprIqEyvlTGUgv9u46+P+pc5ZtS6J/CrC9/cU+QCMQc5rn+h0O25Y2pUfHBO53nYFXa68rXi9isephJKUdMzm32vi13QPLKNVRvKQI=; X-UUID: 8ca12080878f42b4a5f4715cd583c413-20200110 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 294544061; Fri, 10 Jan 2020 14:19:53 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 Jan 2020 14:18:47 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 10 Jan 2020 14:20:24 +0800 Message-ID: <1578637185.29400.3.camel@mtksdaap41> Subject: Re: [PATCH] drm/mediatek: check for comp->funcs From: CK Hu To: Hsin-Yi Wang Date: Fri, 10 Jan 2020 14:19:45 +0800 In-Reply-To: <20200109072900.17988-1-hsinyi@chromium.org> References: <20200109072900.17988-1-hsinyi@chromium.org> X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-MTK: N X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi, Hsin-yi: On Thu, 2020-01-09 at 15:29 +0800, Hsin-Yi Wang wrote: > There might be some comp that doesn't have funcs, eg. hdmi-connector. > Check for comp->funcs otherwise there will be NULL pointer dereference > crash. > > Fixes: bd3de8cd782b ("drm/mediatek: Add gamma property according to hardware capability") > Fixes: 7395eab077f9 ("drm/mediatek: Add ctm property support") Because the fixed patches are still in my tree, so I merge this patch with the fixed patches in mediatek-drm-next-5.6 [1]. [1] https://github.com/ckhu-mediatek/linux.git-tags/commits/mediatek-drm-next-5.6 Regards, CK > Signed-off-by: Hsin-Yi Wang > --- > This patch is based on mediatek's drm branch: > https://github.com/ckhu-mediatek/linux.git-tags/commits/mediatek-drm-next-5.6 > > After > https://patchwork.freedesktop.org/patch/344477/?series=63328&rev=59, > there will also be funcs for hdmi-connector. > --- > drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > index fb142fcfc353..7b392d6c71cc 100644 > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > @@ -808,11 +808,13 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, > > mtk_crtc->ddp_comp[i] = comp; > > - if (comp->funcs->ctm_set) > - has_ctm = true; > + if (comp->funcs) { > + if (comp->funcs->ctm_set) > + has_ctm = true; > > - if (comp->funcs->gamma_set) > - gamma_lut_size = MTK_LUT_SIZE; > + if (comp->funcs->gamma_set) > + gamma_lut_size = MTK_LUT_SIZE; > + } > } > > for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel