Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2996955rdb; Tue, 6 Feb 2024 04:21:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IExmt9YSHx1KpeQYaIv5K4anaVueKuY+0SmkQUOwrpLzwIFIO9zIRr2hyU7hGoXM6DqQLj+ X-Received: by 2002:a17:906:1d5b:b0:a36:c489:7cba with SMTP id o27-20020a1709061d5b00b00a36c4897cbamr1839420ejh.74.1707222111981; Tue, 06 Feb 2024 04:21:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707222111; cv=pass; d=google.com; s=arc-20160816; b=JOFn+nx6fU3D1CEOvpYNSYwXUZ8Bl9PWG9RaIrxuH6TLJNwKfIe+VgyfJ3gSG5jGWo 8392IsYQN1RpgvFZoSHAdSaqyQmFAALbM52Qt9GUeEk8MAMlFowee23Sp7f3WUzdd3JM vaTQ5So5ms9d6ayIqCb0EDD2hl47uud6TT1ADuMUoMp4Pvys5+mDZQ7XT23KOLPSoxT+ Ya49lTvnEqLwo1fxuRXKbdCO1rQsrKKhso3/7ZHilJDubPqu/RJ3BwUs1DLtTMmFnrxP KXBf/OPSyMuF4vP1NEquxCpLBMhysP0SDuQM0ionzG3FLuDWHZBSby0BN1dQnRa+fI3v u+Eg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=RFZIWqma+yOmMSA+HAB0Tf/XxqP8ZZSeguV4JP/a728=; fh=8EAvVHkV6r7WcPhGV+RJwK3eboWQZo3UaIQNbMDX8y8=; b=leujPqVTvvxTI5sMzr1DDgVu11tk1NgyvQFm8xTlxGLpBMwqi6qlZy7+NfQKM4OLgU KBMm3ovIexGMlJ5JG/b1FloNiwNUxo84saRyOItHHb4VBXD0Nlxw1cmqt1vWtXFcEnLy O32MIGlSL+f07Ga/E+GqRBmyGh0HqY5m8vasgkxF22oP9hTe2e/II97rMiXD6bdYULdz V/8eggW2YAq8tEj83HjsWW2VgXz1ehpu1hBBDonBAdV2WUje8nKlVb+TI4nqKuAQnfnx PhkVD0P2DPBCKV3cBkGW+k+P5HxA5CFlOKUl5ordaodv+lKCf3Efzy7kKtyh8tKPoFqh oMCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="jJ/IENCd"; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-54864-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54864-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com X-Forwarded-Encrypted: i=1; AJvYcCXwo8Lsl6SWjkGnrMeZLE5Y746YTtYNmZkbMriC1kpDSbV9avPra4zhdKQSoyD2IMfJzwhili/FQRxMtbkcR7JQ+HjclIsYmmj25rDtww== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f24-20020a170906139800b00a379065c2f5si982639ejc.980.2024.02.06.04.21.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 04:21:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54864-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="jJ/IENCd"; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-54864-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54864-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2FA441F27E34 for ; Tue, 6 Feb 2024 12:11:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9FC9131721; Tue, 6 Feb 2024 12:08:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="jJ/IENCd" 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 4FA7312F5A5 for ; Tue, 6 Feb 2024 12:08:02 +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=1707221290; cv=none; b=S6UnVFTgOc9idyipvXGI+LK+MAtZ5CtK9r5Z/nFeRxQ7c/lIlk5xgaDmeelc4ACjW8OItpI97IK878aTOFuR9drMz2Fw05D6wVuo0nufbB/7Y2koXDZ/YYzyijcN+WtfNzx2skiX2nyqVRX375kgcWwtc4aTnzDrEiHmMrMi1cs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707221290; c=relaxed/simple; bh=vdKksTE0KMJx45MY9qZ2GtileIIp3RIq9EHUTXskHDc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S6sA7SOvk6nhzRXBkUMXUcDO7GrIPv6oVWHdPjOa0iiWurnwvb/VzLzxtENCThKoP9CFEioJflyg/V1A4ofS0bw6yDYYniQhZmtFw9YhPvg4hdYXqATHMrf41J8+cN3S2XfciXVorQcNr2+JOG63A0+UallNSBv9wH8hitB/IJU= 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=jJ/IENCd; 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1707221279; bh=vdKksTE0KMJx45MY9qZ2GtileIIp3RIq9EHUTXskHDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jJ/IENCda0kWOSqR5sOuVwPK5hBAPmBj/MWKcQD2ZQ+N16lBYKRrhp1IPPdyWcViN mJ6sLpbCfXiQW8fTyzRhxO20NlIosNtx53MkJ35wIjP8OgkGAerifmaOAKHq/KG9fE uRAUKOnz5g8l/MXVozjwZSsoEU3Ku5iDlyoWq/CZkpqHD6FI4b5Op4kCrIPLxyH8pq fVUV51/+Fu7WEZpXW/9h5ZxrJeuqKGtvtySLonbsUOm0KrOxDyl0GPfc0pErU3b6se s1BB6wZfl5Kw/w/2PnXCer9Dg6hN1tGO1OC6yo+IgLntlyp+Og+5wNXqvWVWVW21Fc xExJU+CcVALHg== 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 DD41D378207E; Tue, 6 Feb 2024 12:07:58 +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 Subject: [PATCH v4 7/9] drm/mediatek: dsi: Simplify with dev_err_probe and remove gotos Date: Tue, 6 Feb 2024 13:07:46 +0100 Message-ID: <20240206120748.136610-8-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206120748.136610-1-angelogioacchino.delregno@collabora.com> References: <20240206120748.136610-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: 8bit 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. 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 6ee01626d55c..8d407d71e9db 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 *pdev) dsi->driver_data = of_device_get_match_data(dev); dsi->engine_clk = devm_clk_get(dev, "engine"); - if (IS_ERR(dsi->engine_clk)) { - ret = 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"); - if (ret != -EPROBE_DEFER) - dev_err(dev, "Failed to get engine clock: %d\n", ret); - return ret; - } dsi->digital_clk = devm_clk_get(dev, "digital"); - if (IS_ERR(dsi->digital_clk)) { - ret = PTR_ERR(dsi->digital_clk); - - if (ret != -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"); dsi->hs_clk = devm_clk_get(dev, "hs"); - if (IS_ERR(dsi->hs_clk)) { - ret = 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"); regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); dsi->regs = devm_ioremap_resource(dev, regs); - if (IS_ERR(dsi->regs)) { - ret = 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"); dsi->phy = devm_phy_get(dev, "dphy"); - if (IS_ERR(dsi->phy)) { - ret = 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"); irq_num = platform_get_irq(pdev, 0); - if (irq_num < 0) { - ret = irq_num; - return ret; - } + if (irq_num < 0) + return irq_num; dsi->host.ops = &mtk_dsi_ops; dsi->host.dev = dev; ret = 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"); ret = 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"); } init_waitqueue_head(&dsi->irq_wait_queue); @@ -1186,10 +1166,6 @@ static int mtk_dsi_probe(struct platform_device *pdev) dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; return 0; - -err_unregister_host: - mipi_dsi_host_unregister(&dsi->host); - return ret; } static void mtk_dsi_remove(struct platform_device *pdev) -- 2.43.0