* [PATCH 28/62] PNP: isapnp: Check the isapnp_cfg_begin() return value
[not found] <20260223220102.2158611-1-bart.vanassche@linux.dev>
@ 2026-02-23 22:00 ` Bart Van Assche
2026-02-24 12:17 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2026-02-23 22:00 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Ingo Molnar, Will Deacon, Boqun Feng, Waiman Long, linux-kernel,
Marco Elver, Christoph Hellwig, Steven Rostedt, Nick Desaulniers,
Nathan Chancellor, Kees Cook, Jann Horn, Bart Van Assche,
Jaroslav Kysela, Adam Belay, Rafael J. Wysocki, linux-acpi
From: Bart Van Assche <bvanassche@acm.org>
Instead of ignoring isapnp_cfg_begin() failures, propagate the value
returned by this function in case of a failure. This patch prepares
for enabling thread-safety analysis since isapnp_cfg_begin() only locks
a particular mutex if it returns zero.
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Cc: linux-acpi@vger.kernel.org
Fixes: f72e5c5c861c ("[PATCH] PnP Rewrite V0.9 - 2.5.43")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/pnp/isapnp/core.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index 219f96f2aaaf..3591a2791c1a 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -853,7 +853,9 @@ static int isapnp_get_resources(struct pnp_dev *dev)
pnp_dbg(&dev->dev, "get resources\n");
pnp_init_resources(dev);
- isapnp_cfg_begin(dev->card->number, dev->number);
+ ret = isapnp_cfg_begin(dev->card->number, dev->number);
+ if (ret)
+ return ret;
dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE);
if (!dev->active)
goto __end;
@@ -887,10 +889,12 @@ static int isapnp_get_resources(struct pnp_dev *dev)
static int isapnp_set_resources(struct pnp_dev *dev)
{
struct resource *res;
- int tmp;
+ int tmp, ret;
pnp_dbg(&dev->dev, "set resources\n");
- isapnp_cfg_begin(dev->card->number, dev->number);
+ ret = isapnp_cfg_begin(dev->card->number, dev->number);
+ if (ret)
+ return ret;
dev->active = 1;
for (tmp = 0; tmp < ISAPNP_MAX_PORT; tmp++) {
res = pnp_get_resource(dev, IORESOURCE_IO, tmp);
@@ -936,9 +940,13 @@ static int isapnp_set_resources(struct pnp_dev *dev)
static int isapnp_disable_resources(struct pnp_dev *dev)
{
+ int ret;
+
if (!dev->active)
return -EINVAL;
- isapnp_cfg_begin(dev->card->number, dev->number);
+ ret = isapnp_cfg_begin(dev->card->number, dev->number);
+ if (ret)
+ return ret;
isapnp_deactivate(dev->number);
dev->active = 0;
isapnp_cfg_end();
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 28/62] PNP: isapnp: Check the isapnp_cfg_begin() return value
2026-02-23 22:00 ` [PATCH 28/62] PNP: isapnp: Check the isapnp_cfg_begin() return value Bart Van Assche
@ 2026-02-24 12:17 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2026-02-24 12:17 UTC (permalink / raw)
To: Bart Van Assche
Cc: Peter Zijlstra, Ingo Molnar, Will Deacon, Boqun Feng, Waiman Long,
linux-kernel, Marco Elver, Christoph Hellwig, Steven Rostedt,
Nick Desaulniers, Nathan Chancellor, Kees Cook, Jann Horn,
Bart Van Assche, Jaroslav Kysela, Adam Belay, Rafael J. Wysocki,
linux-acpi
On Mon, Feb 23, 2026 at 11:03 PM Bart Van Assche
<bart.vanassche@linux.dev> wrote:
>
> From: Bart Van Assche <bvanassche@acm.org>
>
> Instead of ignoring isapnp_cfg_begin() failures, propagate the value
> returned by this function in case of a failure. This patch prepares
> for enabling thread-safety analysis since isapnp_cfg_begin() only locks
> a particular mutex if it returns zero.
>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Adam Belay <ambx1@neo.rr.com>
> Cc: Rafael J. Wysocki <rafael@kernel.org>
> Cc: linux-acpi@vger.kernel.org
> Fixes: f72e5c5c861c ("[PATCH] PnP Rewrite V0.9 - 2.5.43")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
> ---
> drivers/pnp/isapnp/core.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
> index 219f96f2aaaf..3591a2791c1a 100644
> --- a/drivers/pnp/isapnp/core.c
> +++ b/drivers/pnp/isapnp/core.c
> @@ -853,7 +853,9 @@ static int isapnp_get_resources(struct pnp_dev *dev)
>
> pnp_dbg(&dev->dev, "get resources\n");
> pnp_init_resources(dev);
> - isapnp_cfg_begin(dev->card->number, dev->number);
> + ret = isapnp_cfg_begin(dev->card->number, dev->number);
> + if (ret)
> + return ret;
> dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE);
> if (!dev->active)
> goto __end;
> @@ -887,10 +889,12 @@ static int isapnp_get_resources(struct pnp_dev *dev)
> static int isapnp_set_resources(struct pnp_dev *dev)
> {
> struct resource *res;
> - int tmp;
> + int tmp, ret;
>
> pnp_dbg(&dev->dev, "set resources\n");
> - isapnp_cfg_begin(dev->card->number, dev->number);
> + ret = isapnp_cfg_begin(dev->card->number, dev->number);
> + if (ret)
> + return ret;
> dev->active = 1;
> for (tmp = 0; tmp < ISAPNP_MAX_PORT; tmp++) {
> res = pnp_get_resource(dev, IORESOURCE_IO, tmp);
> @@ -936,9 +940,13 @@ static int isapnp_set_resources(struct pnp_dev *dev)
>
> static int isapnp_disable_resources(struct pnp_dev *dev)
> {
> + int ret;
> +
> if (!dev->active)
> return -EINVAL;
> - isapnp_cfg_begin(dev->card->number, dev->number);
> + ret = isapnp_cfg_begin(dev->card->number, dev->number);
> + if (ret)
> + return ret;
> isapnp_deactivate(dev->number);
> dev->active = 0;
> isapnp_cfg_end();
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-24 12:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260223220102.2158611-1-bart.vanassche@linux.dev>
2026-02-23 22:00 ` [PATCH 28/62] PNP: isapnp: Check the isapnp_cfg_begin() return value Bart Van Assche
2026-02-24 12:17 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox