From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: "Filippo Muscherà" <filippo.muschera@gmail.com>
Cc: jdelvare@suse.com, andi.shyti@kernel.org,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] i2c: amd8111: switch to devm_ functions
Date: Mon, 23 Feb 2026 17:25:06 +0100 [thread overview]
Message-ID: <aZx_Yvo_an2_13Lq@black.igk.intel.com> (raw)
In-Reply-To: <20260202131304.8524-2-filippo.muschera@gmail.com>
On Mon, Feb 02, 2026 at 02:13:04PM +0100, Filippo Muscherà wrote:
> Use devm_kzalloc() to manage the memory allocation of the smbus structure
> and devm_request_region() to manage the I/O port region.
>
> This simplifies the error handling paths in the probe function by removing
> manual cleanup and allows for the removal of the explicit cleanup in the
> remove function.
...
> - if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) {
> - error = -EBUSY;
> - goto out_kfree;
> - }
> + if (!devm_request_region(&dev->dev, smbus->base, smbus->size, amd8111_driver.name))
> + return -EBUSY;
This is a PCI driver. Why not using the pcim_enable_device() with the
respective pcim_*() call for the IO region?
I believe the driver misses pci_disable_device() as of the current
implementation, switching to pcim_*() should address that as well.
...
> static void amd8111_remove(struct pci_dev *dev)
> struct amd_smbus *smbus = pci_get_drvdata(dev);
>
> i2c_del_adapter(&smbus->adapter);
> - release_region(smbus->base, smbus->size);
> - kfree(smbus);
(Somewhere here I would expect pci_disable_device() to be called.)
> }
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-02-23 16:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-02 13:13 [PATCH 1/2] i2c: amd8111: Remove spaces in MODULE_* macros Filippo Muscherà
2026-02-02 13:13 ` [PATCH 2/2] i2c: amd8111: switch to devm_ functions Filippo Muscherà
2026-02-05 11:03 ` Andi Shyti
2026-02-05 12:57 ` Filippo Muscherà
2026-02-23 16:25 ` Andy Shevchenko [this message]
2026-02-24 10:22 ` [PATCH] i2c: amd8111: Switch to pcim_enable_device() and pcim_request_region() Filippo Muscherà
2026-02-24 10:38 ` Andy Shevchenko
2026-02-24 14:42 ` Filippo Muscherà
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=aZx_Yvo_an2_13Lq@black.igk.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=andi.shyti@kernel.org \
--cc=filippo.muschera@gmail.com \
--cc=jdelvare@suse.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox