From patchwork Fri Mar 3 18:54:24 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: 13159403 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [85.220.165.71]) (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 8D66C8F42 for ; Fri, 3 Mar 2023 18:55:04 +0000 (UTC) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pYAYX-0006Ga-2T; Fri, 03 Mar 2023 19:55:01 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pYAYW-001cU6-3l; Fri, 03 Mar 2023 19:55:00 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pYAYU-001uk9-TM; Fri, 03 Mar 2023 19:54:58 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thierry Reding , Benson Leung Cc: kernel@pengutronix.de, Guenter Roeck , linux-pwm@vger.kernel.org, chrome-platform@lists.linux.dev Subject: [PATCH 09/30] pwm: cros-ec: Convert to platform remove callback returning void Date: Fri, 3 Mar 2023 19:54:24 +0100 Message-Id: <20230303185445.2112695-10-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230303185445.2112695-1-u.kleine-koenig@pengutronix.de> References: <20230303185445.2112695-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1651; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=Lfg1K7r0S85QCgR0GcUGLORJ4TBzsm46zCEWzJD8ikg=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBkAkH/i10PAL7z6HOQawqHxTWdGni51iMf0poLu pwiLYMHvsaJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCZAJB/wAKCRDB/BR4rcrs CV7yB/0QHfr9d4v28ysfNOtztChpnwv0TQ9erNSRLwqUuF2BGHOTVkgWAvNx68WKRV8zjQqe3Q4 93hPDq9OVYXaI953ojztueMfKc/RNHGySlooVk3CIFIL08TqXii4jUSTOSInbUnxgYDoCCHw41h /sWfn42kr4gi+BHBs5Z67Z9/RBINTwYcdNKnUwvfND26oCtxs4I74nSQVeqZ+Jwy6lU+nAVyHJQ 3/jgyODdIPTy3L7PHH3yLDVRlaOWnWPVHequfNz515FUnN4J2/eT7E1Ndq06omkEIB5D1XTTQwu OgbCW7XtbgTZ3VfJe/5ZxueRBbqD1+vc6I7mvk/PIWi74tnD 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.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: chrome-platform@lists.linux.dev 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 (mostly) ignored 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. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Reviewed-by: Guenter Roeck --- drivers/pwm/pwm-cros-ec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pwm/pwm-cros-ec.c b/drivers/pwm/pwm-cros-ec.c index 86df6702cb83..90afce212fb0 100644 --- a/drivers/pwm/pwm-cros-ec.c +++ b/drivers/pwm/pwm-cros-ec.c @@ -328,14 +328,12 @@ static int cros_ec_pwm_probe(struct platform_device *pdev) return ret; } -static int cros_ec_pwm_remove(struct platform_device *dev) +static void cros_ec_pwm_remove(struct platform_device *dev) { struct cros_ec_pwm_device *ec_pwm = platform_get_drvdata(dev); struct pwm_chip *chip = &ec_pwm->chip; pwmchip_remove(chip); - - return 0; } #ifdef CONFIG_OF @@ -349,7 +347,7 @@ MODULE_DEVICE_TABLE(of, cros_ec_pwm_of_match); static struct platform_driver cros_ec_pwm_driver = { .probe = cros_ec_pwm_probe, - .remove = cros_ec_pwm_remove, + .remove_new = cros_ec_pwm_remove, .driver = { .name = "cros-ec-pwm", .of_match_table = of_match_ptr(cros_ec_pwm_of_match),