[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5c9207a73bcca44457ae0ef30192c7ca2525da91.camel@mediatek.com>
Date: Wed, 26 Jul 2023 05:26:40 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: "angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>,
"chunkuang.hu@...nel.org" <chunkuang.hu@...nel.org>
CC: "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"fshao@...omium.org" <fshao@...omium.org>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"kernel@...labora.com" <kernel@...labora.com>
Subject: Re: [PATCH v2 2/6] drm/mediatek: mtk_dpi: Simplify with
dev_err_probe()
Hi, Angelo:
On Wed, 2023-07-19 at 09:50 +0200, AngeloGioacchino Del Regno wrote:
> Use dev_err_probe() across the entire probe function of this driver
> to shrink the size.
Reviewed-by: CK Hu <ck.hu@...iatek.com>
>
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@...labora.com>
> Reviewed-by: Fei Shao <fshao@...omium.org>
> ---
> drivers/gpu/drm/mediatek/mtk_dpi.c | 44 ++++++++++----------------
> ----
> 1 file changed, 14 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c
> b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 74068aa70e0c..03a2b900bb50 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -1040,38 +1040,24 @@ static int mtk_dpi_probe(struct
> platform_device *pdev)
> }
> mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> dpi->regs = devm_ioremap_resource(dev, mem);
> - if (IS_ERR(dpi->regs)) {
> - ret = PTR_ERR(dpi->regs);
> - dev_err(dev, "Failed to ioremap mem resource: %d\n",
> ret);
> - return ret;
> - }
> + if (IS_ERR(dpi->regs))
> + return dev_err_probe(dev, PTR_ERR(dpi->regs),
> + "Failed to ioremap mem
> resource\n");
>
> dpi->engine_clk = devm_clk_get(dev, "engine");
> - if (IS_ERR(dpi->engine_clk)) {
> - ret = PTR_ERR(dpi->engine_clk);
> - if (ret != -EPROBE_DEFER)
> - dev_err(dev, "Failed to get engine clock:
> %d\n", ret);
> -
> - return ret;
> - }
> + if (IS_ERR(dpi->engine_clk))
> + return dev_err_probe(dev, PTR_ERR(dpi->engine_clk),
> + "Failed to get engine clock\n");
>
> dpi->pixel_clk = devm_clk_get(dev, "pixel");
> - if (IS_ERR(dpi->pixel_clk)) {
> - ret = PTR_ERR(dpi->pixel_clk);
> - if (ret != -EPROBE_DEFER)
> - dev_err(dev, "Failed to get pixel clock: %d\n",
> ret);
> -
> - return ret;
> - }
> + if (IS_ERR(dpi->pixel_clk))
> + return dev_err_probe(dev, PTR_ERR(dpi->pixel_clk),
> + "Failed to get pixel clock\n");
>
> dpi->tvd_clk = devm_clk_get(dev, "pll");
> - if (IS_ERR(dpi->tvd_clk)) {
> - ret = PTR_ERR(dpi->tvd_clk);
> - if (ret != -EPROBE_DEFER)
> - dev_err(dev, "Failed to get tvdpll clock:
> %d\n", ret);
> -
> - return ret;
> - }
> + if (IS_ERR(dpi->tvd_clk))
> + return dev_err_probe(dev, PTR_ERR(dpi->tvd_clk),
> + "Failed to get tvdpll clock\n");
>
> dpi->irq = platform_get_irq(pdev, 0);
> if (dpi->irq <= 0)
> @@ -1095,10 +1081,8 @@ static int mtk_dpi_probe(struct
> platform_device *pdev)
> return ret;
>
> ret = component_add(dev, &mtk_dpi_component_ops);
> - if (ret) {
> - dev_err(dev, "Failed to add component: %d\n", ret);
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to add
> component.\n");
>
> return 0;
> }
Powered by blists - more mailing lists