linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pata_isapnp: Add check for devm_ioport_map
@ 2023-10-31  4:00 Chen Ni
  2023-10-31 15:18 ` Sergey Shtylyov
  2023-11-10  1:01 ` Damien Le Moal
  0 siblings, 2 replies; 3+ messages in thread
From: Chen Ni @ 2023-10-31  4:00 UTC (permalink / raw)
  To: s.shtylyov, dlemoal, jeff, htejun; +Cc: linux-ide, linux-kernel, Chen Ni

Add check for devm_ioport_map() and return the error if it fails in
order to guarantee the success of devm_ioport_map().

Fixes: 0d5ff566779f ("libata: convert to iomap")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/ata/pata_isapnp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
index 25a63d043c8e..0f77e0424066 100644
--- a/drivers/ata/pata_isapnp.c
+++ b/drivers/ata/pata_isapnp.c
@@ -82,6 +82,9 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev
 	if (pnp_port_valid(idev, 1)) {
 		ctl_addr = devm_ioport_map(&idev->dev,
 					   pnp_port_start(idev, 1), 1);
+		if (!ctl_addr)
+			return -ENOMEM;
+
 		ap->ioaddr.altstatus_addr = ctl_addr;
 		ap->ioaddr.ctl_addr = ctl_addr;
 		ap->ops = &isapnp_port_ops;
-- 
2.25.1


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

* Re: [PATCH] pata_isapnp: Add check for devm_ioport_map
  2023-10-31  4:00 [PATCH] pata_isapnp: Add check for devm_ioport_map Chen Ni
@ 2023-10-31 15:18 ` Sergey Shtylyov
  2023-11-10  1:01 ` Damien Le Moal
  1 sibling, 0 replies; 3+ messages in thread
From: Sergey Shtylyov @ 2023-10-31 15:18 UTC (permalink / raw)
  To: Chen Ni, dlemoal, jeff, htejun; +Cc: linux-ide, linux-kernel

Hello!

On 10/31/23 7:00 AM, Chen Ni wrote:

> Add check for devm_ioport_map() and return the error if it fails in
> order to guarantee the success of devm_ioport_map().
> 
> Fixes: 0d5ff566779f ("libata: convert to iomap")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>

Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>

[...]

MBR, Sergey

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

* Re: [PATCH] pata_isapnp: Add check for devm_ioport_map
  2023-10-31  4:00 [PATCH] pata_isapnp: Add check for devm_ioport_map Chen Ni
  2023-10-31 15:18 ` Sergey Shtylyov
@ 2023-11-10  1:01 ` Damien Le Moal
  1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2023-11-10  1:01 UTC (permalink / raw)
  To: Chen Ni, s.shtylyov, jeff, htejun; +Cc: linux-ide, linux-kernel

On 10/31/23 13:00, Chen Ni wrote:
> Add check for devm_ioport_map() and return the error if it fails in
> order to guarantee the success of devm_ioport_map().
> 
> Fixes: 0d5ff566779f ("libata: convert to iomap")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>

Apologies for the delay. This fell through the cracks :)
Applied to for-6.7-fixes. I will send this next week.

> ---
>  drivers/ata/pata_isapnp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
> index 25a63d043c8e..0f77e0424066 100644
> --- a/drivers/ata/pata_isapnp.c
> +++ b/drivers/ata/pata_isapnp.c
> @@ -82,6 +82,9 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev
>  	if (pnp_port_valid(idev, 1)) {
>  		ctl_addr = devm_ioport_map(&idev->dev,
>  					   pnp_port_start(idev, 1), 1);
> +		if (!ctl_addr)
> +			return -ENOMEM;
> +
>  		ap->ioaddr.altstatus_addr = ctl_addr;
>  		ap->ioaddr.ctl_addr = ctl_addr;
>  		ap->ops = &isapnp_port_ops;

-- 
Damien Le Moal
Western Digital Research


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

end of thread, other threads:[~2023-11-10  1:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-31  4:00 [PATCH] pata_isapnp: Add check for devm_ioport_map Chen Ni
2023-10-31 15:18 ` Sergey Shtylyov
2023-11-10  1:01 ` Damien Le Moal

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).