linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] Serial 2/2
@ 2002-09-29  4:17 Hu Gang
  0 siblings, 0 replies; 3+ messages in thread
From: Hu Gang @ 2002-09-29  4:17 UTC (permalink / raw)
  To: Linux Kernel

[-- Attachment #1: Type: text/plain, Size: 878 bytes --]

Hello all:

fix ret check bug: 2.5.39

--- drivers/serial/8250.c~old	Sun Sep 29 12:06:03 2002
+++ drivers/serial/8250.c	Sun Sep 29 12:17:05 2002
@@ -1564,7 +1565,7 @@
 
 	if (up->port.type == PORT_RSA) {
 		ret = serial8250_request_rsa_resource(up, &res_rsa);
-		if (ret)
+		if (ret == 0)
 			return ret;
 	}
 
@@ -1582,10 +1583,10 @@
 			ret = -ENOMEM;
 	}
 
-	if (ret) {
-		if (res_rsa)
+	if (ret == 0) {
+		if (res_rsa == 0)
 			release_resource(res_rsa);
-		if (res)
+		if (res == 0)
 			release_resource(res);
 	}
 	return ret;
@@ -1611,11 +1612,11 @@
 	 * tells us whether we can probe for the type of port.
 	 */
 	ret = serial8250_request_std_resource(up, &res_std);
-	if (ret)
+	if (ret == 0)
 		return;
 
 	ret = serial8250_request_rsa_resource(up, &res_rsa);
-	if (ret)
+	if (ret == 0)
 		probeflags &= ~PROBE_RSA;
 
 	if (flags & UART_CONFIG_TYPE)


-- 
		- Hu Gang

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [patch] Serial 2/2
  2002-09-29 16:11 Matthew Wilcox
@ 2002-09-29 17:27 ` Russell King
  0 siblings, 0 replies; 3+ messages in thread
From: Russell King @ 2002-09-29 17:27 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Hu Gang, linux-kernel

On Sun, Sep 29, 2002 at 05:11:04PM +0100, Matthew Wilcox wrote:
> i'm not sure about the rest of your changes, but this one is definitely
> wrong.

I've sent Hu my proposed solution and I'm waiting to hear back.

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


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

* Re: [patch] Serial 2/2
@ 2002-09-29 16:11 Matthew Wilcox
  2002-09-29 17:27 ` Russell King
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2002-09-29 16:11 UTC (permalink / raw)
  To: Hu Gang; +Cc: linux-kernel


> @@ -1582,10 +1583,10 @@
>                          ret = -ENOMEM;
>          }
>  
> - if (ret) {
> - if (res_rsa)
> + if (ret == 0) {
> + if (res_rsa == 0)
>                          release_resource(res_rsa);
> - if (res)
> + if (res == 0)
>                          release_resource(res);
>          }
>          return ret;

definitely not.

	if (res_rsa)
		release_resource(res_rsa);

will release the resource if we allocated it.  your patch calls
release_resource with an argument of NULL, and we'll leak the resource
we allocated.

i'm not sure about the rest of your changes, but this one is definitely
wrong.

-- 
Revolutions do not require corporate support.

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

end of thread, other threads:[~2002-09-29 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-29  4:17 [patch] Serial 2/2 Hu Gang
2002-09-29 16:11 Matthew Wilcox
2002-09-29 17:27 ` Russell King

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