All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Wu Hao <hao.wu@intel.com>, Moritz Fischer <mdf@kernel.org>,
	Xu Yilun <yilun.xu@intel.com>
Cc: Tom Rix <trix@redhat.com>,
	linux-fpga@vger.kernel.org, kernel@pengutronix.de
Subject: [PATCH 06/13] fpga: dfl-fme-main: Convert to platform remove callback returning void
Date: Tue, 19 Dec 2023 18:32:04 +0100	[thread overview]
Message-ID: <438bb4797984fbfd0cef501010a64fa1e42ad9f4.1703006638.git.u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <cover.1703006638.git.u.kleine-koenig@pengutronix.de>

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 <u.kleine-koenig@pengutronix.de>
---
 drivers/fpga/dfl-fme-main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/fpga/dfl-fme-main.c b/drivers/fpga/dfl-fme-main.c
index 3dcf990bd261..a2b5da0093da 100644
--- a/drivers/fpga/dfl-fme-main.c
+++ b/drivers/fpga/dfl-fme-main.c
@@ -730,13 +730,11 @@ static int fme_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int fme_remove(struct platform_device *pdev)
+static void fme_remove(struct platform_device *pdev)
 {
 	dfl_fpga_dev_ops_unregister(pdev);
 	dfl_fpga_dev_feature_uinit(pdev);
 	fme_dev_destroy(pdev);
-
-	return 0;
 }
 
 static const struct attribute_group *fme_dev_groups[] = {
@@ -751,7 +749,7 @@ static struct platform_driver fme_driver = {
 		.dev_groups = fme_dev_groups,
 	},
 	.probe   = fme_probe,
-	.remove  = fme_remove,
+	.remove_new = fme_remove,
 };
 
 module_platform_driver(fme_driver);
-- 
2.42.0


  parent reply	other threads:[~2023-12-19 17:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19 17:31 [PATCH 00/13] fpga: Convert to platform remove callback returning void Uwe Kleine-König
2023-12-19 17:31 ` Uwe Kleine-König
2023-12-19 17:31 ` [PATCH 01/13] fpga: altera-fpga2sdram: " Uwe Kleine-König
2023-12-19 17:32 ` [PATCH 02/13] fpga: altera-freeze-bridge: " Uwe Kleine-König
2023-12-19 17:32 ` [PATCH 03/13] fpga: altera-hps2fpga: " Uwe Kleine-König
2023-12-19 17:32 ` [PATCH 04/13] fpga: dfl-afu-main: " Uwe Kleine-König
2023-12-19 17:32 ` [PATCH 05/13] fpga: dfl-fme-br: " Uwe Kleine-König
2023-12-19 17:32 ` Uwe Kleine-König [this message]
2023-12-19 17:32 ` [PATCH 07/13] fpga: dfl-fme-region: " Uwe Kleine-König
2023-12-19 17:32 ` [PATCH 08/13] fpga: intel-m10-bmc-sec-update: " Uwe Kleine-König
2023-12-19 17:32 ` [PATCH 09/13] fpga: of-fpga-region: " Uwe Kleine-König
2023-12-19 17:32 ` [PATCH 10/13] fpga: socfpga-a10: " Uwe Kleine-König
2023-12-19 17:32 ` [PATCH 11/13] fpga: stratix10-soc: " Uwe Kleine-König
2023-12-19 17:32 ` [PATCH 12/13] fpga: xilinx-pr-decoupler: " Uwe Kleine-König
2023-12-19 17:32   ` Uwe Kleine-König
2023-12-19 17:32 ` [PATCH 13/13] fpga: zynq-fpga: " Uwe Kleine-König
2023-12-19 17:32   ` Uwe Kleine-König
2023-12-25  6:01 ` [PATCH 00/13] fpga: " Xu Yilun
2023-12-25  6:01   ` Xu Yilun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=438bb4797984fbfd0cef501010a64fa1e42ad9f4.1703006638.git.u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=hao.wu@intel.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-fpga@vger.kernel.org \
    --cc=mdf@kernel.org \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.