From nobody Thu Nov 14 17:04:07 2024 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22BBC1B818 for ; Thu, 15 Feb 2024 08:53:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707987211; cv=none; b=lX6H17dK51bDwbGyhGfHXGaRowgwN0iwVZaq/qsHRhsn5qNuQrpsIRPULjBhirG/pWe01nFNAq0GlHcw8gQIJZOS8ph2ejcyRMbQbRExHLz56IAyT+GenVVOZtRF9AEKGEjcAfLO4tQ7INKBqjGIWWPAhFHw0gOtisyzvqYe0R8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707987211; c=relaxed/simple; bh=jewx2tbyoHc8XkBckJRK6kMqgXG1NMO8tumrU7DXJMM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hxme+MUUIzX+a1y/QADxcUwHkE0YNH43xGCZbS8TDBnC78sv4JG0T3xYfzPVzxCWbTvT9a5Yk1B0xO6bZSpyN5EIGWlpmfq9DEbRjzJ3snO6l9qsFZFK2exF53bGj9GFyAGGsYkhHmINu+H42Udk0Rw5jZ84LcwAsNBnMcXxq5U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=qGLdn6Dx; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="qGLdn6Dx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1707987208; bh=jewx2tbyoHc8XkBckJRK6kMqgXG1NMO8tumrU7DXJMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qGLdn6Dx2Tsr2gpHcGQbcAKqsCLbT7fgh4ZWv5StJ65+WIWsMWBAvd/mOB9cMgGPl AVg+t2ygVDNo65HKoUB16F61w8045yCnUM38NyBPE5XCYSVlnOpBTv0aq6qiPd7gmb pCTFuW3rQNQ1cNXaH+jSfL7v8qYKGGU05+F6z/WVGkmm11EbbAVxBQ5at3MXfklcsx /FpqjTufwuWUJppN42Q2GsR18Js4SVIz3P9Ig2TpL7mhnO4WR0W2/FNj/tlR9Qj/nE rUInpEfhPnNr18tpTwGtxVu0s0HOv0qGI6tH+/BKsDNr/OnFjVx55cgfDpiyFGLF6k IinOiVV42fMdw== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (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 madrid.collaboradmins.com (Postfix) with ESMTPSA id 836D737820B2; Thu, 15 Feb 2024 08:53:27 +0000 (UTC) From: AngeloGioacchino Del Regno To: chunkuang.hu@kernel.org Cc: fshao@chromium.org, 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, Alexandre Mergnat Subject: [PATCH v6 7/9] drm/mediatek: dsi: Simplify with dev_err_probe and remove gotos Date: Thu, 15 Feb 2024 09:53:14 +0100 Message-ID: <20240215085316.56835-8-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240215085316.56835-1-angelogioacchino.delregno@collabora.com> References: <20240215085316.56835-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Most of the functions that are called in the probe callback are devm managed, or all but mipi_dsi_host_register(): simplify the probe function's error paths with dev_err_probe() and remove the lonely instance of `goto err_unregister_host` by just directly calling the mipi_dsi_host_unregister() function in the devm_request_irq() error path, allowing to also remove the same label. Reviewed-by: Alexandre Mergnat Signed-off-by: AngeloGioacchino Del Regno --- drivers/gpu/drm/mediatek/mtk_dsi.c | 60 +++++++++--------------------- 1 file changed, 18 insertions(+), 42 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index b3dd6251d611..195ff4dfc3a3 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -1117,64 +1117,44 @@ static int mtk_dsi_probe(struct platform_device *pd= ev) dsi->driver_data =3D of_device_get_match_data(dev); =20 dsi->engine_clk =3D devm_clk_get(dev, "engine"); - if (IS_ERR(dsi->engine_clk)) { - ret =3D PTR_ERR(dsi->engine_clk); + if (IS_ERR(dsi->engine_clk)) + return dev_err_probe(dev, PTR_ERR(dsi->engine_clk), + "Failed to get engine clock\n"); =20 - if (ret !=3D -EPROBE_DEFER) - dev_err(dev, "Failed to get engine clock: %d\n", ret); - return ret; - } =20 dsi->digital_clk =3D devm_clk_get(dev, "digital"); - if (IS_ERR(dsi->digital_clk)) { - ret =3D PTR_ERR(dsi->digital_clk); - - if (ret !=3D -EPROBE_DEFER) - dev_err(dev, "Failed to get digital clock: %d\n", ret); - return ret; - } + if (IS_ERR(dsi->digital_clk)) + return dev_err_probe(dev, PTR_ERR(dsi->digital_clk), + "Failed to get digital clock\n"); =20 dsi->hs_clk =3D devm_clk_get(dev, "hs"); - if (IS_ERR(dsi->hs_clk)) { - ret =3D PTR_ERR(dsi->hs_clk); - dev_err(dev, "Failed to get hs clock: %d\n", ret); - return ret; - } + if (IS_ERR(dsi->hs_clk)) + return dev_err_probe(dev, PTR_ERR(dsi->hs_clk), "Failed to get hs clock\= n"); =20 regs =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); dsi->regs =3D devm_ioremap_resource(dev, regs); - if (IS_ERR(dsi->regs)) { - ret =3D PTR_ERR(dsi->regs); - dev_err(dev, "Failed to ioremap memory: %d\n", ret); - return ret; - } + if (IS_ERR(dsi->regs)) + return dev_err_probe(dev, PTR_ERR(dsi->regs), "Failed to ioremap memory\= n"); =20 dsi->phy =3D devm_phy_get(dev, "dphy"); - if (IS_ERR(dsi->phy)) { - ret =3D PTR_ERR(dsi->phy); - dev_err(dev, "Failed to get MIPI-DPHY: %d\n", ret); - return ret; - } + if (IS_ERR(dsi->phy)) + return dev_err_probe(dev, PTR_ERR(dsi->phy), "Failed to get MIPI-DPHY\n"= ); =20 irq_num =3D platform_get_irq(pdev, 0); - if (irq_num < 0) { - ret =3D irq_num; - return ret; - } + if (irq_num < 0) + return irq_num; =20 dsi->host.ops =3D &mtk_dsi_ops; dsi->host.dev =3D dev; ret =3D mipi_dsi_host_register(&dsi->host); - if (ret < 0) { - dev_err(dev, "failed to register DSI host: %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to register DSI host\n"); =20 ret =3D devm_request_irq(&pdev->dev, irq_num, mtk_dsi_irq, IRQF_TRIGGER_NONE, dev_name(&pdev->dev), dsi); if (ret) { - dev_err(&pdev->dev, "failed to request mediatek dsi irq\n"); - goto err_unregister_host; + mipi_dsi_host_unregister(&dsi->host); + return dev_err_probe(&pdev->dev, ret, "Failed to request DSI irq\n"); } =20 init_waitqueue_head(&dsi->irq_wait_queue); @@ -1186,10 +1166,6 @@ static int mtk_dsi_probe(struct platform_device *pde= v) dsi->bridge.type =3D DRM_MODE_CONNECTOR_DSI; =20 return 0; - -err_unregister_host: - mipi_dsi_host_unregister(&dsi->host); - return ret; } =20 static void mtk_dsi_remove(struct platform_device *pdev) --=20 2.43.0