From patchwork Wed Apr 12 11:52:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13209051 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 BCD6CC7619A for ; Wed, 12 Apr 2023 11:53:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1D1FB10E79D; Wed, 12 Apr 2023 11:52:59 +0000 (UTC) Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by gabe.freedesktop.org (Postfix) with ESMTPS id DD30610E79D for ; Wed, 12 Apr 2023 11:52:57 +0000 (UTC) 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 EDFE3660320C; Wed, 12 Apr 2023 12:52:55 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1681300376; bh=NPIAVgMhynQ80l9U9V5P644tA7N53bJbVDqHK/OjMuo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lkfgRVO3zlxW/ULul1JEIzxHKMnfjPRKgrhNMxBI62JzfTWMberyyWWM0NbFzZjC7 aVJDkpE18di0qOfzKt/nljSpmHQoc50BkXEytQs9I1S5GmG1ofDp76c3ZUmipR42ek FxqIIYF6r+u2ppCypZBhGdWvZ/SRaCTKoHdoFew6W50f7VSKBfIUGVFahvykYC6z2a 1t66hgV5g7RKIPICFV9AhKEey7BIviJG0nPHw3bXbBKCou0aAlrzPlF9xOgimxD0Qd fU/HOusxroeZ+LS5XXvQmw5FeX8ZRGFLpN0lzcPOuWsbuk8qDv76DwfeyXwVx0bsR/ yaByGHIFz0ZXw== From: AngeloGioacchino Del Regno To: chunkuang.hu@kernel.org Subject: [PATCH 2/4] drm/mediatek: mtk_dpi: Simplify with dev_err_probe() Date: Wed, 12 Apr 2023 13:52:48 +0200 Message-Id: <20230412115250.164899-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230412115250.164899-1-angelogioacchino.delregno@collabora.com> References: <20230412115250.164899-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: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, kernel@collabora.com, linux-arm-kernel@lists.infradead.org, angelogioacchino.delregno@collabora.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use dev_err_probe() across the entire probe function of this driver to shrink the size. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Fei Shao --- 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 2d5f3fc34f61..6be65ea21f8f 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; }