From patchwork Wed Sep 27 08:10:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 145256 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2473718vqu; Wed, 27 Sep 2023 01:28:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmrbRWap0K5cvWV39NeAqkqnDEDp6glqE06n7St5H7yhzpKZmnpS2kxiP3XmrARhNall/Q X-Received: by 2002:a17:902:6b86:b0:1bf:557c:5a2c with SMTP id p6-20020a1709026b8600b001bf557c5a2cmr862333plk.44.1695803292944; Wed, 27 Sep 2023 01:28:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695803292; cv=none; d=google.com; s=arc-20160816; b=Q0ksYB/wfrMlBPN9LNPeMO9P1jr1hluBPaIImVC1bFMIE93BPSpRyHf25fF84Cnmn1 +tg8fXsdMIr8Z2JVfCcXwnfkdWT1AZSACEQ1mNrSKk8iX0UNFa0OH/gZgetN3rOeFPvP 6BODYv24aE4vLAQL1/dQ9gTQPXR2+otfWe5ugbMdlbbD7z3Oz1YM6vRHEIuTLv7F0PzZ 2/MtJqD31nkuDHB4SEArTRF5mcSrBsduoNTAB3E7r2NETZIEhrT0aYXSR9to14NC4R1D HqsJV14VnopnWJIwNIvZJbCLF3EtQZIpAPEmEn9ta0tHi9fHjPMpy6dX/Tr11gR9tIyF kyeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=0FGLghiqp5SNt1mIEuBka92xhvspYQ6CjYyl9wkpp9k=; fh=Dlo1odEjcRtH1BJ+R8/KYHyn3hjJitJ8wbI0kHiiB+U=; b=FlV5oebeoZxuOiQViVStOztwR8WHsNdbTlHw5zDcGAglaRHBtjWY6YmlXhnEwCQjIG 94yl0mv4///BZMFmaCsTjWyBce8sA8cR2nuZxmna/drlGXd3ejTLW0Kuv6h4zbpN3/Vk fF4uatiG6HqOhus0W/GR/KIwovZ3fdYFifG+VYMmV84x/xsFB/D6I50dzC4h2hYe6XiM ktWXDFpOS1Alm09Uzr3lOM3Y9wtBirj/TrevnMwIz9VF868RFwfeVDxh/9Qhh8gzWNVG NMEwOUmCTthGAQ8mE+t48GlI65ofKfyMf4YHy6s9ovRjCUHUOOftAXc1E9f14/Ur1yHR 7IEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id w2-20020a1709026f0200b001c3c39520aesi9768591plk.560.2023.09.27.01.28.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 01:28:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 95FC581C3653; Wed, 27 Sep 2023 01:14:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230476AbjI0IMa (ORCPT + 23 others); Wed, 27 Sep 2023 04:12:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230245AbjI0ILE (ORCPT ); Wed, 27 Sep 2023 04:11:04 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2EAC136 for ; Wed, 27 Sep 2023 01:11:00 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlPdC-00086t-Jn; Wed, 27 Sep 2023 10:10:50 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlPdB-009I7y-QL; Wed, 27 Sep 2023 10:10:49 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qlPdB-005BRG-H4; Wed, 27 Sep 2023 10:10:49 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Mark Gross , Vadim Pasternak Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 19/27] platform/mellanox: nvsw-sn2201: Convert to platform remove callback returning void Date: Wed, 27 Sep 2023 10:10:32 +0200 Message-Id: <20230927081040.2198742-20-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> References: <20230927081040.2198742-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2047; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=6XfHk0S7bPOzQoL6+8JJudU1CUxgDhv75KyTmedpZUw=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlE+NzWIGN/61OxNnBHOlQieO5BOjJVQ2TaOhNX iAEfMwuXiOJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZRPjcwAKCRCPgPtYfRL+ TmI+B/4weiDZumoyGKba8bd4q0TK/I1+YV8rcG4ye97HqiBQ5ZF0vpggBZSSoHvyT3HyCccblJS wUZ/r1gPvOlJ2itBa+UySAtoAwwXKUEmP014qU4GGFN3pLL6u8kIKX11gkINJylWdAK0yZ747JT 55unsHgiUKSiqgeke7PiOy7lwuzwjrQktjbr7bf4WfjGm9cSXYmOxM7d6+USokuKWXAMrv+9Fbi JJhEN/aMGpxCxH5+R4m3E5g4JtGi/rqq7RhAkdEvHkWllgNNeqMu6NoIoSJTIyMfTrIU732GK+Q THruy2dF3ffrYZY4qibyYdJoT/EKNOLwdz69i5oH7HR9CX0H X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 27 Sep 2023 01:14:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778178633433781348 X-GMAIL-MSGID: 1778178633433781348 The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/platform/mellanox/nvsw-sn2201.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/mellanox/nvsw-sn2201.c b/drivers/platform/mellanox/nvsw-sn2201.c index 75b699676ca6..3ef655591424 100644 --- a/drivers/platform/mellanox/nvsw-sn2201.c +++ b/drivers/platform/mellanox/nvsw-sn2201.c @@ -1217,7 +1217,7 @@ static int nvsw_sn2201_probe(struct platform_device *pdev) return nvsw_sn2201_config_pre_init(nvsw_sn2201); } -static int nvsw_sn2201_remove(struct platform_device *pdev) +static void nvsw_sn2201_remove(struct platform_device *pdev) { struct nvsw_sn2201 *nvsw_sn2201 = platform_get_drvdata(pdev); @@ -1239,8 +1239,6 @@ static int nvsw_sn2201_remove(struct platform_device *pdev) /* Unregister I2C controller. */ if (nvsw_sn2201->pdev_i2c) platform_device_unregister(nvsw_sn2201->pdev_i2c); - - return 0; } static const struct acpi_device_id nvsw_sn2201_acpi_ids[] = { @@ -1252,7 +1250,7 @@ MODULE_DEVICE_TABLE(acpi, nvsw_sn2201_acpi_ids); static struct platform_driver nvsw_sn2201_driver = { .probe = nvsw_sn2201_probe, - .remove = nvsw_sn2201_remove, + .remove_new = nvsw_sn2201_remove, .driver = { .name = "nvsw-sn2201", .acpi_match_table = nvsw_sn2201_acpi_ids,