Message ID | 20230725073234.55892-2-angelogioacchino.delregno@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2301812vqg; Tue, 25 Jul 2023 00:43:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlGfWm9POLkiKir8krrAkrt7UCGGDh/e2XGJWCFuGZ0z8Ez/tBNz3esLKKLxWiLbKYX2/naE X-Received: by 2002:a05:6808:3087:b0:3a3:91f8:d3da with SMTP id bl7-20020a056808308700b003a391f8d3damr17012651oib.13.1690270994832; Tue, 25 Jul 2023 00:43:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690270994; cv=none; d=google.com; s=arc-20160816; b=HNm80uTDkQs0nZI0x3F7uGlCiytfFo6cR9AgmKtngiAAFu4sU4XYpstILFs9cJiLJd 2op6815DMphSzoaEnd0amwAd4EC0ZHe3HHy7dp6QpuBa9+DKVoYzaQoa2/tlvZ0Wck7W N5/yCwXjuiB+L87k/gSzAXyLjUYbMcR+N5DK7Rk0lTHpoA53CdD6dmRsjxcH8GtQmuGs IbBx9+iYCXec3XfGbeXItWDApC2AdkbiFD8riy3mNovKUrPAGlFI50rQjRyhZSFy6BjT D8yJYAGMogSDmnG/HstIcHyMlNvZHL/EIVvDhNhexMkczUoX5AOZEKWgt1rR/ArPCWIC 4o9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=X8Venfjko70ZSph3HMOgKeQ1UbSb98Zd5gRGR2o1BLU=; fh=NaqalB1tj5vFZdx9YyHQK0my+e3FFV+OeQMYXcmlwy8=; b=TAVFTOih/i1/SSGbx6tdVhNrh0Rl1TaLLm1HUQdbvMM7SCFLWSJoBOrdlw0RK2gU37 Tr6EsP35iTD23CB3ygvJonQHpGYJZ2EgVFxf9F2CO5ExPf3FDmq/iYTcxUX1P2neqXkV M5pqyt/Jhl2eLvmTYzR5duCleYOmIDTI6T9Pk7BwxrDn0uJGA5J0GVo+B2bsHcohQc1v 4IYtSzM70l2UXZxx2l9IdbXWu+qU+nKgiERIdS0/EldglHygeJU8TZl9ETws3ndTvd4D JmNHi3baCmR1R+NUuipJw9IUAB5kuRGcbG2oc/xQeUDLCUocOXP9pmAHzPJWzgcSaUg0 ND9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=YW3anaAj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id om12-20020a17090b3a8c00b00263d559dbf1si3155701pjb.55.2023.07.25.00.43.01; Tue, 25 Jul 2023 00:43:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=YW3anaAj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232656AbjGYHe5 (ORCPT <rfc822;kloczko.tomasz@gmail.com> + 99 others); Tue, 25 Jul 2023 03:34:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230167AbjGYHeK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Jul 2023 03:34:10 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B44DB1BD7 for <linux-kernel@vger.kernel.org>; Tue, 25 Jul 2023 00:32:48 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id BE8106607105; Tue, 25 Jul 2023 08:32:46 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1690270367; bh=UxJIucVDAWGMbZsVbKjD2E/6cJnPX0LdsT06i3DZxik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YW3anaAj7ptZfarIiyPRoDecQCMcNbYlxkGGh5CU4bz6SPe94Zao8/ciXWnBZ9ULd dByyJ/wHMOcMYtiuhM/cTo2Q0v74tvh15Dgvl35xTm5C3AQmo6jJlux/DqCDqiELWj Xl2mtdgPPmHrrc/xNKwqP2LmuMzpParND7W0GF/Mo9rp7zmyHtwu+TeXOiDL/Laaev JY18VzL4HiSypdUpc4gzpD+oNISP5HxwXmgb8T57QVeb9bSbef5/46wuYWl+dDUr5a Hw+nt0Cw97usTttpPQhBrRbXfXk3ND0qTzC6qdTvyPQOYsL9lGtzXmm4c+A0NXgQJp 71CFG73YOthuw== From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> To: chunkuang.hu@kernel.org Cc: p.zabel@pengutronix.de, airlied@gmail.com, daniel@ffwll.ch, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@collabora.com, wenst@chromium.org, nfraprado@collabora.com, ehristev@collabora.com, Alexandre Mergnat <amergnat@baylibre.com> Subject: [PATCH v7 01/11] drm/mediatek: dp: Add missing error checks in mtk_dp_parse_capabilities Date: Tue, 25 Jul 2023 09:32:24 +0200 Message-ID: <20230725073234.55892-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230725073234.55892-1-angelogioacchino.delregno@collabora.com> References: <20230725073234.55892-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772377598769607782 X-GMAIL-MSGID: 1772377598769607782 |
Series |
MediaTek DisplayPort: support eDP and aux-bus
|
|
Commit Message
AngeloGioacchino Del Regno
July 25, 2023, 7:32 a.m. UTC
If reading the RX capabilities fails the training pattern will be set wrongly: add error checking for drm_dp_read_dpcd_caps() and return if anything went wrong with it. While at it, also add a less critical error check when writing to clear the ESI0 IRQ vector. Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver") Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Tested-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> --- drivers/gpu/drm/mediatek/mtk_dp.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
Comments
Hi, Angelo: On Tue, 2023-07-25 at 09:32 +0200, AngeloGioacchino Del Regno wrote: > If reading the RX capabilities fails the training pattern will be set > wrongly: add error checking for drm_dp_read_dpcd_caps() and return if > anything went wrong with it. > > While at it, also add a less critical error check when writing to > clear the ESI0 IRQ vector. Reviewed-by: CK Hu <ck.hu@mediatek.com> > > Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort > driver") > Signed-off-by: AngeloGioacchino Del Regno < > angelogioacchino.delregno@collabora.com> > Tested-by: Chen-Yu Tsai <wenst@chromium.org> > Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> > --- > drivers/gpu/drm/mediatek/mtk_dp.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c > b/drivers/gpu/drm/mediatek/mtk_dp.c > index 64eee77452c0..c58b775877a3 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dp.c > +++ b/drivers/gpu/drm/mediatek/mtk_dp.c > @@ -1588,7 +1588,9 @@ static int mtk_dp_parse_capabilities(struct > mtk_dp *mtk_dp) > u8 val; > ssize_t ret; > > - drm_dp_read_dpcd_caps(&mtk_dp->aux, mtk_dp->rx_cap); > + ret = drm_dp_read_dpcd_caps(&mtk_dp->aux, mtk_dp->rx_cap); > + if (ret < 0) > + return ret; > > if (drm_dp_tps4_supported(mtk_dp->rx_cap)) > mtk_dp->train_info.channel_eq_pattern = > DP_TRAINING_PATTERN_4; > @@ -1615,10 +1617,13 @@ static int mtk_dp_parse_capabilities(struct > mtk_dp *mtk_dp) > return ret == 0 ? -EIO : ret; > } > > - if (val) > - drm_dp_dpcd_writeb(&mtk_dp->aux, > - DP_DEVICE_SERVICE_IRQ_VECTOR > _ESI0, > - val); > + if (val) { > + ret = drm_dp_dpcd_writeb(&mtk_dp->aux, > + DP_DEVICE_SERVICE_IRQ_ > VECTOR_ESI0, > + val); > + if (ret < 0) > + return ret; > + } > } > > return 0;
diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c index 64eee77452c0..c58b775877a3 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -1588,7 +1588,9 @@ static int mtk_dp_parse_capabilities(struct mtk_dp *mtk_dp) u8 val; ssize_t ret; - drm_dp_read_dpcd_caps(&mtk_dp->aux, mtk_dp->rx_cap); + ret = drm_dp_read_dpcd_caps(&mtk_dp->aux, mtk_dp->rx_cap); + if (ret < 0) + return ret; if (drm_dp_tps4_supported(mtk_dp->rx_cap)) mtk_dp->train_info.channel_eq_pattern = DP_TRAINING_PATTERN_4; @@ -1615,10 +1617,13 @@ static int mtk_dp_parse_capabilities(struct mtk_dp *mtk_dp) return ret == 0 ? -EIO : ret; } - if (val) - drm_dp_dpcd_writeb(&mtk_dp->aux, - DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0, - val); + if (val) { + ret = drm_dp_dpcd_writeb(&mtk_dp->aux, + DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0, + val); + if (ret < 0) + return ret; + } } return 0;