From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 45216CCF2C2 for ; Fri, 16 Oct 2026 12:33:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bipwu/flamLDUOCqjjV8/42g1ehh1fg/G0SoZ0+zF8E=; b=Lb8K7dm5SDHxm/ sQVJTRrkmD5OZ7GU/2JwjA9s6DxaQp0nexsqbszfEXBsLUx1xSH/+tQ69vI/0pmswjj8zIFZIhGl5 01PTtpFMA27JziXguBPtpGblBKmsiCGXSbu5Rz01RZ0nCFFXzQvYMllezoKRcKGHAV5010jdvOx7Z Poq/BvbzKjLzoAYq9r4BG55XrrE+aso0mC8im787xJj6MsaAicvMlaxeDkTU+V/b9PMsRd/69KKJf 3QlFxbAbaeJbA38r/Klzq69bt3hXDh07f6SIyqY2sYaGiW7MlA0pAizZpDOTzXr0KCagMkqb0niZr YtJqOxhk5HSUgTI/Ylgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xHh8G-00000002tai-2YQS; Fri, 16 Oct 2026 12:33:56 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xHh88-00000002tD0-2D8E; Fri, 16 Oct 2026 12:33:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=s1C9diKxpqsE/iNRAA1eCcro3inoj/bahh0/u4u1u3U=; b=m+I+gggIvISICDGt8X0JMUQZ6v qmoXUafui0v4J+Zcoq+RAKpTcBdpTP7PLWycS9zvsNZVCMvg4gD/B6rPESeSVYZ70zJHGgAS6op9e a1bpDfiuK5klJ7uTQ1LUXAiLkh3qXehTGoMA/+2+fpc9v/9Hfo0PW+CjcsboHmITdrzg1GemJTpvj w6VijBpdYtwkup1Vb1UQP/U06x9/3U2nGMIezTYo3Xi1CqoKeYy8z8iUImY/DH/f0yy878yTNmi4f +g82AgVvMA6if1vNJW+5geNilsmbf9MvOpsphSLv57TRNWcLAhw6elTpkgQkxLcHWDC1k2enMPl85 AaaP7fcA==; Received: from bali.collaboradmins.com ([2a01:4f8:201:9162::2]) by desiato.infradead.org with esmtps (Exim 4.99.5 #2 (Red Hat Linux)) id 1xHh81-00000001UAR-3P1Z; Fri, 16 Oct 2026 12:33:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1792154020; bh=9lCyn40IwF4rDvXDZ0j+eeMRIyFJb+e+Y3gZ62CCvmk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=FYcZ+V74jU6fm8vQ8DyF2xFH4G9h4v1GnmQNM3xYfhTNBVXYRoSIBGJIeV7irltMS D3RYF/Hw8aco1y1Anc5OpO4yYR9FtU1cynxI3aJAABzzqjkcThiINEx8FJiuGlEyw8 GyilLXMkJpHQLzFQLBuD37sLDYxtaZol/JgFB0nPPg8qrPcAGEMC+xgzHp6VUU6jC3 /u8LK3KMlVnYiQzkLlmGk4NS9DKab1JbefsCt9fxPo1cj4CAemKRYspPOw++k8ZlN7 KFEtkNhDGNvE5lf0cB+OZn1/FK+vz4u/NERE2RHadDsluUy1OKE7JKZxfKssgEK8Hb YDYK8BtIZBvog== Received: from yukiji.home (unknown [100.64.0.131]) (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: laeyraud) by bali.collaboradmins.com (Postfix) with ESMTPSA id B70F117E12B9; Fri, 16 Oct 2026 14:33:39 +0200 (CEST) From: Louis-Alexis Eyraud Date: Fri, 16 Oct 2026 14:33:01 +0200 Subject: [PATCH v14 09/23] scsi: ufs: mediatek: Rework init function MIME-Version: 1.0 Message-Id: <20261016-mt8196-ufs-v14-9-e8d565e0cd45@collabora.com> References: <20261016-mt8196-ufs-v14-0-e8d565e0cd45@collabora.com> In-Reply-To: <20261016-mt8196-ufs-v14-0-e8d565e0cd45@collabora.com> To: Chunfeng Yun , Vinod Koul , Neil Armstrong , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Peter Wang , Chaotian Jing , Alim Akhtar , Bart Van Assche , Bean Huo , Stanley Jhu , Stanley Jhu , "James E.J. Bottomley" , "Martin K. Petersen" , Philipp Zabel , Liam Girdwood , Mark Brown Cc: kernel@collabora.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, Nicolas Frattaroli X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792154009; l=3160; i=louisalexis.eyraud@collabora.com; s=20250113; h=from:subject:message-id; bh=KAU9OtojZVx+ojOXDguAoNC8iNg+6Jtr1nYCzbwN/t8=; b=3xDTZiSaveiiAFNpD1CgoQElhLtSJi9VPth6jF2Tuk89QvvtojQng1nMoVl7bM2Hn2WZFPZxd efLiB74zQpEBZnb+qY/W44cPpE/MnT8rKBLT47vSrNhLeZUITxElMQ0 X-Developer-Key: i=louisalexis.eyraud@collabora.com; a=ed25519; pk=CHFBDB2Kqh4EHc6JIqFn69GhxJJAzc0Zr4e8QxtumuM= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261016_133343_930746_B692D736 X-CRM114-Status: GOOD ( 17.54 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org From: Nicolas Frattaroli Printing an error message on ENOMEM is pointless. The print will not work because there is no memory. Adding an of_match_device to the init function is pointless. Why would a different device with a different probe function ever use the same init function? Get rid of it. zero-initialising an error variable just so you can then goto a bare return statement with that error variable to signal success is also pointless, just return directly, there's no unwind being done. Reviewed-by: Peter Wang Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Nicolas Frattaroli --- drivers/ufs/host/ufs-mediatek.c | 43 +++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c index c8c5f85507af..1be533020ed4 100644 --- a/drivers/ufs/host/ufs-mediatek.c +++ b/drivers/ufs/host/ufs-mediatek.c @@ -54,18 +54,6 @@ static const struct ufs_dev_quirk ufs_mtk_dev_fixups[] = { {} }; -static const struct ufs_mtk_soc_data mt8183_data = { - .has_avdd09 = true, -}; - -static const struct of_device_id ufs_mtk_of_match[] = { - { .compatible = "mediatek,mt8183-ufshci", .data = &mt8183_data }, - { .compatible = "mediatek,mt8192-ufshci" }, - { .compatible = "mediatek,mt8195-ufshci" }, - {}, -}; -MODULE_DEVICE_TABLE(of, ufs_mtk_of_match); - /* * Details of UIC Errors */ @@ -1321,29 +1309,19 @@ static int ufs_mtk_get_supplies(struct ufs_mtk_host *host) */ static int ufs_mtk_init(struct ufs_hba *hba) { - const struct of_device_id *id; struct device *dev = hba->dev; struct ufs_mtk_host *host; struct Scsi_Host *shost = hba->host; - int err = 0; + int err; struct arm_smccc_res res; host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); - if (!host) { - err = -ENOMEM; - dev_info(dev, "%s: no memory for mtk ufs host\n", __func__); - goto out; - } + if (!host) + return -ENOMEM; host->hba = hba; ufshcd_set_variant(hba, host); - id = of_match_device(ufs_mtk_of_match, dev); - if (!id) { - err = -EINVAL; - goto out; - } - /* Initialize host capability */ ufs_mtk_init_host_caps(hba); @@ -1419,11 +1397,10 @@ static int ufs_mtk_init(struct ufs_hba *hba) ufs_mtk_get_hw_ip_version(hba); - goto out; + return 0; out_variant_clear: ufshcd_set_variant(hba, NULL); -out: return err; } @@ -2473,6 +2450,18 @@ static const struct ufs_hba_variant_ops ufs_hba_mtk_vops = { .config_scsi_dev = ufs_mtk_config_scsi_dev, }; +static const struct ufs_mtk_soc_data mt8183_data = { + .has_avdd09 = true, +}; + +static const struct of_device_id ufs_mtk_of_match[] = { + { .compatible = "mediatek,mt8183-ufshci", .data = &mt8183_data }, + { .compatible = "mediatek,mt8192-ufshci" }, + { .compatible = "mediatek,mt8195-ufshci" }, + {}, +}; +MODULE_DEVICE_TABLE(of, ufs_mtk_of_match); + /** * ufs_mtk_probe - probe routine of the driver * @pdev: pointer to Platform device handle -- 2.56.0 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy