From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
To: Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@wdc.com>,
Bart Van Assche <bvanassche@acm.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Chunfeng Yun <chunfeng.yun@mediatek.com>,
Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>,
Peter Wang <peter.wang@mediatek.com>,
Stanley Jhu <chu.stanley@gmail.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Chaotian Jing <Chaotian.Jing@mediatek.com>,
Neil Armstrong <neil.armstrong@linaro.org>
Cc: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>,
kernel@collabora.com, linux-scsi@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
linux-phy@lists.infradead.org,
Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Subject: [PATCH v6 08/24] scsi: ufs: mediatek: Rework init function
Date: Sat, 24 Jan 2026 13:00:54 +0100 [thread overview]
Message-ID: <20260124-mt8196-ufs-v6-8-e7c005b60028@collabora.com> (raw)
In-Reply-To: <20260124-mt8196-ufs-v6-0-e7c005b60028@collabora.com>
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 <peter.wang@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
---
drivers/ufs/host/ufs-mediatek.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index 7fcf4ceeb56e..4cb1a1b400ac 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -1248,29 +1248,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);
@@ -1344,11 +1334,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;
}
--
2.52.0
next prev parent reply other threads:[~2026-01-24 12:02 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-24 12:00 [PATCH v6 00/24] MediaTek UFS Cleanup and MT8196 Enablement Nicolas Frattaroli
2026-01-24 12:00 ` [PATCH v6 01/24] dt-bindings: phy: Add mediatek,mt8196-ufsphy variant Nicolas Frattaroli
2026-01-24 12:00 ` [PATCH v6 02/24] dt-bindings: ufs: mediatek,ufs: Complete the binding Nicolas Frattaroli
2026-01-24 12:00 ` [PATCH v6 03/24] dt-bindings: ufs: mediatek,ufs: Add mt8196 variant Nicolas Frattaroli
2026-01-24 12:00 ` [PATCH v6 04/24] scsi: ufs: mediatek: Move MTK_SIP_UFS_CONTROL to mtk_sip_svc.h Nicolas Frattaroli
2026-01-24 12:00 ` [PATCH v6 05/24] phy: mediatek: ufs: Add support for resets Nicolas Frattaroli
2026-01-24 12:00 ` [PATCH v6 06/24] scsi: ufs: mediatek: Rework resets Nicolas Frattaroli
2026-01-24 12:00 ` [PATCH v6 07/24] scsi: ufs: mediatek: Rework 0.9V regulator Nicolas Frattaroli
2026-01-24 12:00 ` Nicolas Frattaroli [this message]
2026-01-24 12:00 ` [PATCH v6 09/24] scsi: ufs: mediatek: Rework the crypt-boost stuff Nicolas Frattaroli
2026-01-24 12:00 ` [PATCH v6 10/24] scsi: ufs: mediatek: Handle misc host voltage regulators Nicolas Frattaroli
2026-01-24 12:00 ` [PATCH v6 11/24] scsi: ufs: mediatek: Rework probe function Nicolas Frattaroli
2026-01-24 12:00 ` [PATCH v6 12/24] scsi: ufs: mediatek: Remove vendor kernel quirks cruft Nicolas Frattaroli
2026-01-24 12:00 ` [PATCH v6 13/24] scsi: ufs: mediatek: Use the common PHY framework Nicolas Frattaroli
2026-01-24 12:01 ` [PATCH v6 14/24] scsi: ufs: mediatek: Switch to newer PM ops helpers Nicolas Frattaroli
2026-01-24 22:41 ` kernel test robot
2026-01-24 12:01 ` [PATCH v6 15/24] scsi: ufs: mediatek: Remove mediatek,ufs-broken-rtc property Nicolas Frattaroli
2026-01-24 12:01 ` [PATCH v6 16/24] scsi: ufs: mediatek: Rework _ufs_mtk_clk_scale error paths Nicolas Frattaroli
2026-01-24 12:01 ` [PATCH v6 17/24] scsi: ufs: mediatek: Clean up logging prints Nicolas Frattaroli
2026-01-24 12:01 ` [PATCH v6 18/24] scsi: ufs: mediatek: Rework ufs_mtk_wait_idle_state Nicolas Frattaroli
2026-01-24 12:01 ` [PATCH v6 19/24] scsi: ufs: mediatek: Don't acquire dvfsrc-vcore twice Nicolas Frattaroli
2026-01-24 12:01 ` [PATCH v6 20/24] scsi: ufs: mediatek: Rework hardware version reading Nicolas Frattaroli
2026-01-24 12:01 ` [PATCH v6 21/24] scsi: ufs: mediatek: Back up idle timer in per-instance struct Nicolas Frattaroli
2026-01-24 12:01 ` [PATCH v6 22/24] scsi: ufs: mediatek: Remove ret local from link_startup_notify Nicolas Frattaroli
2026-01-24 12:01 ` [PATCH v6 23/24] scsi: ufs: mediatek: Remove undocumented "clk-scale-up-vcore-min" Nicolas Frattaroli
2026-01-26 14:53 ` AngeloGioacchino Del Regno
2026-01-24 12:01 ` [PATCH v6 24/24] scsi: ufs: mediatek: Add MT8196 compatible, update copyright Nicolas Frattaroli
2026-02-16 12:40 ` [PATCH v6 00/24] MediaTek UFS Cleanup and MT8196 Enablement AngeloGioacchino Del Regno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260124-mt8196-ufs-v6-8-e7c005b60028@collabora.com \
--to=nicolas.frattaroli@collabora.com \
--cc=Chaotian.Jing@mediatek.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alim.akhtar@samsung.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=avri.altman@wdc.com \
--cc=broonie@kernel.org \
--cc=bvanassche@acm.org \
--cc=chu.stanley@gmail.com \
--cc=chunfeng.yun@mediatek.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kernel@collabora.com \
--cc=kishon@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=louisalexis.eyraud@collabora.com \
--cc=martin.petersen@oracle.com \
--cc=matthias.bgg@gmail.com \
--cc=neil.armstrong@linaro.org \
--cc=p.zabel@pengutronix.de \
--cc=peter.wang@mediatek.com \
--cc=robh@kernel.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®