linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: fm801-gp - Fix an error handling path
@ 2022-12-19 21:36 Christophe JAILLET
  2022-12-20 18:59 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2022-12-19 21:36 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-input

This looks odd to call release_resource() for something allocated with
request_region().
Use release_region() instead.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is speculative and compile tested only.
---
 drivers/input/gameport/fm801-gp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/gameport/fm801-gp.c b/drivers/input/gameport/fm801-gp.c
index e785d36b1926..90ef1935084a 100644
--- a/drivers/input/gameport/fm801-gp.c
+++ b/drivers/input/gameport/fm801-gp.c
@@ -118,7 +118,7 @@ static void fm801_gp_remove(struct pci_dev *pci)
 	struct fm801_gp *gp = pci_get_drvdata(pci);
 
 	gameport_unregister_port(gp->gameport);
-	release_resource(gp->res_port);
+	release_region(gp->gameport->io, 0x10);
 	kfree(gp);
 
 	pci_disable_device(pci);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: fm801-gp - Fix an error handling path
  2022-12-19 21:36 [PATCH] Input: fm801-gp - Fix an error handling path Christophe JAILLET
@ 2022-12-20 18:59 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2022-12-20 18:59 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: linux-kernel, kernel-janitors, linux-input

Hi Christophe,

On Mon, Dec 19, 2022 at 10:36:47PM +0100, Christophe JAILLET wrote:
> This looks odd to call release_resource() for something allocated with
> request_region().
> Use release_region() instead.

I do not see why it is weird. request_region() gives you an instance of
"resource" structure which can later be freed. If we indeed want to use
release_region() (and hardcode the length in both places) then we should
also remove gp->res_port member. But I really do not find anything wrong
nor do I want to touch these old drivers...

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-20 18:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-19 21:36 [PATCH] Input: fm801-gp - Fix an error handling path Christophe JAILLET
2022-12-20 18:59 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).