Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1512845 > unrolled thread

[PATCH 6/6] g_NCR5380: Fix release region in error handling

Started byOndrej Zary <linux@rainbow-software.org>
First post2016-10-31 21:30 +0100
Last post2016-11-02 08:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 6/6] g_NCR5380: Fix release region in error handling Ondrej Zary <linux@rainbow-software.org> - 2016-10-31 21:30 +0100
    Re: [PATCH 6/6] g_NCR5380: Fix release region in error handling Finn Thain <fthain@telegraphics.com.au> - 2016-11-02 08:50 +0100

#1512845 — [PATCH 6/6] g_NCR5380: Fix release region in error handling

FromOndrej Zary <linux@rainbow-software.org>
Date2016-10-31 21:30 +0100
Subject[PATCH 6/6] g_NCR5380: Fix release region in error handling
Message-ID<syrns-7fi-9@gated-at.bofh.it>
When a SW-configurable card is specified but not found, the driver
releases wrong region, causing the following message in kernel log:
Trying to free nonexistent resource <0000000000000000-000000000000000f>

Fix it by assigning base earlier.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
 drivers/scsi/g_NCR5380.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 6a08d3e..d33e71f 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -258,12 +258,12 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
 		if (ports[i]) {
 			/* At this point we have our region reserved */
 			magic_configure(i, 0, magic); /* no IRQ yet */
-			outb(0xc0, ports[i] + 9);
-			if (inb(ports[i] + 9) != 0x80) {
+			base = ports[i];
+			outb(0xc0, base + 9);
+			if (inb(base + 9) != 0x80) {
 				ret = -ENODEV;
 				goto out_release;
 			}
-			base = ports[i];
 			port_idx = i;
 		} else
 			return -EINVAL;
-- 
Ondrej Zary

[toc] | [next] | [standalone]


#1513710

FromFinn Thain <fthain@telegraphics.com.au>
Date2016-11-02 08:50 +0100
Message-ID<syYt3-3jx-21@gated-at.bofh.it>
In reply to#1512845
On Mon, 31 Oct 2016, Ondrej Zary wrote:

> When a SW-configurable card is specified but not found, the driver
> releases wrong region, causing the following message in kernel log:
> Trying to free nonexistent resource <0000000000000000-000000000000000f>
> 
> Fix it by assigning base earlier.
> 
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

This fix is not related to the others in this series. It could go at the 
beginning where it is easy to cherry-pick.

Fixes: a8cfbcaec0c1 ("scsi: g_NCR5380: Stop using scsi_module.c")
Acked-by: Finn Thain <fthain@telegraphics.com.au>

> ---
>  drivers/scsi/g_NCR5380.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
> index 6a08d3e..d33e71f 100644
> --- a/drivers/scsi/g_NCR5380.c
> +++ b/drivers/scsi/g_NCR5380.c
> @@ -258,12 +258,12 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
>  		if (ports[i]) {
>  			/* At this point we have our region reserved */
>  			magic_configure(i, 0, magic); /* no IRQ yet */
> -			outb(0xc0, ports[i] + 9);
> -			if (inb(ports[i] + 9) != 0x80) {
> +			base = ports[i];
> +			outb(0xc0, base + 9);
> +			if (inb(base + 9) != 0x80) {
>  				ret = -ENODEV;
>  				goto out_release;
>  			}
> -			base = ports[i];
>  			port_idx = i;
>  		} else
>  			return -EINVAL;
> 

-- 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web