From nobody Thu Mar 19 05:45:25 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 8CC712C17B3; Fri, 6 Mar 2026 13:26:19 +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=1772803580; cv=pass; b=lf3MDbDfueJ2ej86wmSrQOwWSFHeGmMU6b1o6oIRXlNf2GRQppJcX+AxLplZL8p2V04UPqumqW/yebZ3qp4tbmJvGiVAad1EA+M6y/B0EN0NOhGTAFfuOSDhjxYa/Xx2u9wlCO2esjs79OsSX97Tto3293FQz5+uW7ANKqWhDO4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772803580; c=relaxed/simple; bh=w3AZfNS02pMmh1/aLXq8fp80IavtkQwt18Za2M+6tK4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aFE3V96QtH+iNA0Oj70hzBHETBr+IbFGtwMb+D/YdI4z0oWTWdXo3zaVyMIH/SN/Bq2zt1eKzfj9qaHht5qz61YvkU/NHiVtpTlW8+CwOsn7lPX+C4vpY+jmILbdnCLyTLxOpioSgaDiGB8zP3Hd9dsKqg98ZY9Dyn4KdWyXvaE= 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=WVvxHWh4; 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="WVvxHWh4" ARC-Seal: i=1; a=rsa-sha256; t=1772803549; cv=none; d=zohomail.com; s=zohoarc; b=hG0il03Mc/qfJTASGS7mIdUr0xwAY/97lyO0eM5/3jX64cJ9fJvQk6nBMe6VF4IkxyMCNX7//OucCWme+83SPIVkCfg3/mWEObmUMvxJUtHXaFL14Q1KpGAMOXUtARnJc+KLxkUGD9oPdIdUoWyehLdvQTPRohyQ5RHFzVuh4IQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772803549; 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=XbI1SV8H/A4qosZYbkwhTobyA++HOSFk8wTW5Aruoj4=; b=IFb+h7PJ0PlBfaarpdcFi5CwNM+dKNmn4X12LRHlNGGAlRKNxg1NwWtxjxdQUUrS3YODxEq5LQiVw6RJU3FGWTLMUyaj74ow7F5V9IsgAOftP+gOlk6sYDEVRv+BvFVSZb+Qy3cz2tiwkNyFM7t5OZITyrVbqyEQj79e6xw4XFg= 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=1772803549; 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=XbI1SV8H/A4qosZYbkwhTobyA++HOSFk8wTW5Aruoj4=; b=WVvxHWh4+b2yNOI5LVoHrOfk20DOrKm5UaYviOtTdle66FlrphTruamvdgGzOuBn xkJkN0e2np2nj1EVQeMW4hhPSJXz0uoz9Mi6p20w0TlfiSElSHLUT8metqy/eCV1q1X frlMVWlSDW3dI6nY22Z/g4i4MJWsi9d0d/c5jHNs= Received: by mx.zohomail.com with SMTPS id 1772803548131217.32860788159417; Fri, 6 Mar 2026 05:25:48 -0800 (PST) From: Nicolas Frattaroli Date: Fri, 06 Mar 2026 14:24:49 +0100 Subject: [PATCH v9 08/23] 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: <20260306-mt8196-ufs-v9-8-55b073f7a830@collabora.com> References: <20260306-mt8196-ufs-v9-0-55b073f7a830@collabora.com> In-Reply-To: <20260306-mt8196-ufs-v9-0-55b073f7a830@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 0d22ac4c925c..392383e03ab0 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.53.0