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 BEDECD6ACFB for ; Thu, 18 Dec 2025 12:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type: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=y/dWA1LpALk1O5+OPvzra1oDujoAnYvqaxa98lv4dvk=; b=d6UTGNjP9HyMsecFNpiDCUwQL6 rxiuoeS5SIylZflw6EJzXrcVrMi7tw1SP+K5ReQHfz154HP6lWrtjTJe/m3eBdAsOUDiHnn5vbUvH 66tJ7M68EH6k17tM+a/SPFa6Ufs0UdtRL4LJ+MwuhgPLyesaloqbNZrPDKbZGvOp1f1EcS0gR1y3b ObEuR7EAFxyr9MhXA33fwkJcxyZHVPejUS6cEdtvDxBK3/QdchW7lFCBlsgyDGUej/UWCiIW1ZALt 9HQVl28z3uLybUQix+eg5ivP9ZD/wQe8ciArxPApRz5rsZj8eLmosmKmqmgRENhKQPNF+hgZ+QTuu BX8N0/sA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vWDYa-00000008SBf-0ivl; Thu, 18 Dec 2025 12:56:39 +0000 Received: from sender4-pp-f112.zoho.com ([136.143.188.112]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vWDYV-00000008S6T-3wGo; Thu, 18 Dec 2025 12:56:33 +0000 ARC-Seal: i=1; a=rsa-sha256; t=1766062582; cv=none; d=zohomail.com; s=zohoarc; b=kpfEp3ZTw0Tt2idEMHYISa2reZtwqBKS2EHSj+W3SsN8dGH/o8q3kWEWE/RQdGyQEs7W4xkeRFxXvM836Vtufn2CZ9AMWUQkPF/lMUgRTZWImqP9+yod4PQMhs93FcYcKObdOaIbl5Yn01DtcjCo4OZ19+spJ+pfVVnxV5bHUXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766062582; 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=y/dWA1LpALk1O5+OPvzra1oDujoAnYvqaxa98lv4dvk=; b=J5SKp3WsE0PzL/4mdxAk/nWwlUSZLRziVGZSoQBqDnvRFu0HbeSp0e24P6PUtxgy7Wd4OZw0K0o9cotpN39PuX5hJquv3NLOc60pHXNOXyxaDgicdiyKJ9KcNBXYlDGyRQhSEbrnfonT691DDf2xC4cJmnzcewANYQIrmFbhAp0= 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=1766062582; 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=y/dWA1LpALk1O5+OPvzra1oDujoAnYvqaxa98lv4dvk=; b=XMHDS/CkesdAj0TMt5zbt8+j4WpMfqPyG/NiBCbEj9/fAlm1+qn80t6p/94w69Ee obrnNMGxilKKBWrfiSX0WTBWKQV79WBwlo8W2nbZwkcY/F+irve2wV0tjEviwwz7P0k l81g6opavtiFGBdGsDfaGNJQIG+OuIR1csPGZJhU= Received: by mx.zohomail.com with SMTPS id 1766062582042292.16112334319314; Thu, 18 Dec 2025 04:56:22 -0800 (PST) From: Nicolas Frattaroli Date: Thu, 18 Dec 2025 13:54:58 +0100 Subject: [PATCH v4 08/25] scsi: ufs: mediatek: Rework init function MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20251218-mt8196-ufs-v4-8-ddec7a369dd2@collabora.com> References: <20251218-mt8196-ufs-v4-0-ddec7a369dd2@collabora.com> In-Reply-To: <20251218-mt8196-ufs-v4-0-ddec7a369dd2@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251218_045632_047276_2ECD0088 X-CRM114-Status: GOOD ( 14.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. 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-mediatek.c index a7aab2332ef2..131f71145a12 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