From patchwork Tue Dec 17 15:43:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13912046 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 7C875E7717F for ; Tue, 17 Dec 2024 15:44:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D762410E9F6; Tue, 17 Dec 2024 15:44:37 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="GattxcTM"; dkim-atps=neutral Received: from bali.collaboradmins.com (bali.collaboradmins.com [IPv6:2a01:4f8:201:9162::2]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7205910E9EF for ; Tue, 17 Dec 2024 15:44:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1734450258; bh=eS/Fbh3gYUfMYZO7irNmf6AE0VLkc+opJ68mgu+vaws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GattxcTMSR+xRDKcGZiCOKb8DDZh14IE8sMnCJdSxlfprwaZ5nTAPShayail1DGmr AokCvNOObrq6LbAhC8YZ5zUZP4g1LY9fR/UkNuOX5x544nkc1+mXnR7q79vqIIrNTl fx9aZHBw9JPBVrnQ+kCw6ls+v6yu0SguAppUS/u90WSb9LTy69Es3bGEXD4ceZt86v stYmeXWsu1bmNUwAGPJ17m4kYcoQDibCM3tBNmzU7YFSOb9lqwQfct/YJXzvfbC11w /63ek+E5SFLujRHH7N2WCbE1Ah0OD3epHbLqzsf2Ise6WvzOFhXFx3VUH/tPmA+vR4 P9o3WhBjLEicw== 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 bali.collaboradmins.com (Postfix) with ESMTPSA id C0CDD17E37C5; Tue, 17 Dec 2024 16:44:16 +0100 (CET) From: AngeloGioacchino Del Regno To: chunkuang.hu@kernel.org Cc: p.zabel@pengutronix.de, airlied@gmail.com, simona@ffwll.ch, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, ck.hu@mediatek.com, jitao.shi@mediatek.com, jie.qiu@mediatek.com, junzhi.zhao@mediatek.com, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@collabora.com, dmitry.baryshkov@linaro.org Subject: [PATCH v3 19/33] drm/mediatek: mtk_hdmi: Use dev_err_probe() in mtk_hdmi_dt_parse_pdata() Date: Tue, 17 Dec 2024 16:43:31 +0100 Message-ID: <20241217154345.276919-20-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241217154345.276919-1-angelogioacchino.delregno@collabora.com> References: <20241217154345.276919-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Change error prints to use dev_err_probe() instead of dev_err() where possible in function mtk_hdmi_dt_parse_pdata(), used only during device probe. While at it, also beautify some prints. Signed-off-by: AngeloGioacchino Del Regno --- drivers/gpu/drm/mediatek/mtk_hdmi.c | 34 ++++++++++------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index eb38f4b7674e..c20d42ec387a 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -1372,30 +1372,23 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - struct device_node *cec_np, *remote, *i2c_np; + struct device_node *remote, *i2c_np; struct platform_device *cec_pdev; struct regmap *regmap; int ret; ret = mtk_hdmi_get_all_clk(hdmi, np); - if (ret) { - if (ret != -EPROBE_DEFER) - dev_err(dev, "Failed to get clocks: %d\n", ret); - - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Failed to get clocks\n"); /* The CEC module handles HDMI hotplug detection */ cec_np = of_get_compatible_child(np->parent, "mediatek,mt8173-cec"); - if (!cec_np) { - dev_err(dev, "Failed to find CEC node\n"); - return -EINVAL; - } + if (!cec_np) + return dev_err_probe(dev, -EINVAL, "Failed to find CEC node\n"); cec_pdev = of_find_device_by_node(cec_np); if (!cec_pdev) { - dev_err(hdmi->dev, "Waiting for CEC device %pOF\n", - cec_np); + dev_err(hdmi->dev, "Waiting for CEC device %pOF\n", cec_np); of_node_put(cec_np); return -EPROBE_DEFER; } @@ -1413,9 +1406,8 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, if (IS_ERR(regmap)) ret = PTR_ERR(regmap); if (ret) { - dev_err(dev, - "Failed to get system configuration registers: %d\n", - ret); + dev_err_probe(dev, ret, + "Failed to get system configuration registers\n"); goto put_device; } hdmi->sys_regmap = regmap; @@ -1443,20 +1435,16 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, } i2c_np = of_parse_phandle(remote, "ddc-i2c-bus", 0); + of_node_put(remote); if (!i2c_np) { - dev_err(dev, "Failed to find ddc-i2c-bus node in %pOF\n", - remote); - of_node_put(remote); - ret = -EINVAL; + ret = dev_err_probe(dev, -EINVAL, "No ddc-i2c-bus in connector\n"); goto put_device; } - of_node_put(remote); hdmi->ddc_adpt = of_find_i2c_adapter_by_node(i2c_np); of_node_put(i2c_np); if (!hdmi->ddc_adpt) { - dev_err(dev, "Failed to get ddc i2c adapter by node\n"); - ret = -EINVAL; + ret = dev_err_probe(dev, -EINVAL, "Failed to get ddc i2c adapter by node\n"); goto put_device; }