From nobody Mon Feb 9 19:05:23 2026 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (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 0E3F749B3E7; Thu, 8 Jan 2026 10:51:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767869480; cv=pass; b=ZdKwURBOpVYrOKj0tmjlEqX7PNJKV91L0qY/8f8wURS1zSlU/HKl50sRs2eJt/MB5PIzUOk+U95EM11+q1yaEpns06Fw6PerbNOTiu+oaP1sNveoTo31G1kOBsTunp0oau6N0xvfil0WuE+OVlOcjF/3mzOLWV97edZHbEXms3A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767869480; c=relaxed/simple; bh=VlDuvSAFYsYwBqBjSsyHGEnx0MllC37fVNB4u5/biYg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tsHodA8BxR3yWWDDuRMp1x+Iq12FG78WI6xYAeyBnPLfcuj223rycBdfbV/FdSsIP9YN4irMtxdLwzctNg0dIJ9ohqJO4PDhAc95fAJeZJtWmGMw1nLieSLvcB0htMHoM+3q4kbIg8PRAXP1lECJAHbFGeWELtbMXObTM7DYjkQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b=MtpRE6pm; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b="MtpRE6pm" ARC-Seal: i=1; a=rsa-sha256; t=1767869443; cv=none; d=zohomail.com; s=zohoarc; b=gnaegLFYTjzQb9w/KHBI69mSwoOHYp/AokFJbkkPULM/9p5PIrVtNjfBboA4045BWiHaGVrqbqUowlUOZeQOc/9TIFsR9cChbsrqdSKlw03Vo2Mwn5Cas4m/i3pTcFbcdKzZDN7jfhpxnjxiTUSoFR38KsiBuf7kkjDG/gpzWEE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767869443; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=Oa+opGGt7s/tPHlnUkQmx0naTPhUgBCi4cq0ey1VFNM=; b=ZJtIGpi9JbIPXUgPVSAEB369UyooCOq1u80MRSg67SvOmdcJoWyliwJsKQ8CvtYonfUP3IjprJpAusDCkIZT+3dMU0jVpRJJXnY+Ttpl/XyyBLZ6WP04Yik9pSmMtT7XnNM38ZCkuqFx5qcLbbAPxX+ckTzNeTlXqZKFy2U7zt0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=nicolas.frattaroli@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1767869443; s=zohomail; d=collabora.com; i=nicolas.frattaroli@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:References:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=Oa+opGGt7s/tPHlnUkQmx0naTPhUgBCi4cq0ey1VFNM=; b=MtpRE6pmjgnky4tAzD7Xr4aNv4dWmVSDX67hWJb2pAyZN8JgVotTHRkCUtckJ02b o0s2KJTJ99eYvct6uaSjpwMCbJvuhhyhVlCzZd1KzQhL5IDU44a34KcgfSOG3qVOXhb YNiRqmiFgSoFCq7zjlB41cX2D5d8TQjM/pZXdwTw= Received: by mx.zohomail.com with SMTPS id 176786944147897.54331480220787; Thu, 8 Jan 2026 02:50:41 -0800 (PST) From: Nicolas Frattaroli Date: Thu, 08 Jan 2026 11:49:27 +0100 Subject: [PATCH v5 08/24] scsi: ufs: mediatek: Rework init function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260108-mt8196-ufs-v5-8-49215157ec41@collabora.com> References: <20260108-mt8196-ufs-v5-0-49215157ec41@collabora.com> In-Reply-To: <20260108-mt8196-ufs-v5-0-49215157ec41@collabora.com> To: Alim Akhtar , Avri Altman , Bart Van Assche , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Chunfeng Yun , Vinod Koul , Kishon Vijay Abraham I , Peter Wang , Stanley Jhu , "James E.J. Bottomley" , "Martin K. Petersen" , Philipp Zabel , Liam Girdwood , Mark Brown , Chaotian Jing , Neil Armstrong Cc: Louis-Alexis Eyraud , 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 X-Mailer: b4 0.14.3 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 | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediate= k.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 =3D hba->dev; struct ufs_mtk_host *host; struct Scsi_Host *shost =3D hba->host; - int err =3D 0; + int err; struct arm_smccc_res res; =20 host =3D devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); - if (!host) { - err =3D -ENOMEM; - dev_info(dev, "%s: no memory for mtk ufs host\n", __func__); - goto out; - } + if (!host) + return -ENOMEM; =20 host->hba =3D hba; ufshcd_set_variant(hba, host); =20 - id =3D of_match_device(ufs_mtk_of_match, dev); - if (!id) { - err =3D -EINVAL; - goto out; - } - /* Initialize host capability */ ufs_mtk_init_host_caps(hba); =20 @@ -1344,11 +1334,10 @@ static int ufs_mtk_init(struct ufs_hba *hba) =20 ufs_mtk_get_hw_ip_version(hba); =20 - goto out; + return 0; =20 out_variant_clear: ufshcd_set_variant(hba, NULL); -out: return err; } =20 --=20 2.52.0