linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Dike <jdike@addtoit.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Cc: user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] [RFC PATCH] uml: fix double statement if missing braces
Date: Tue, 26 Aug 2008 12:52:22 -0400	[thread overview]
Message-ID: <20080826165222.GA18584@c2.user-mode-linux.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0808190904200.4551@wrl-59.cs.helsinki.fi>

On Tue, Aug 19, 2008 at 09:09:16AM +0300, Ilpo Järvinen wrote:
> ...I'm not fully sure what's the intention here, ie., whether
> the return belongs to a block with the assignment or not.

Yes, this is confused, although it just happens to compile to
something sane.  Your patch is fine, but I think the whole thing needs
some more cleanup.  See the patch below.

     	  	    	Jeff

-- 
Work email - jdike at linux dot intel dot com

The testing for the host's TLS support was somewhat confused - notably
in the indentation of a return.

This cleans it up:
	*supports_tls is only set to 0 once
	any error besides EINVAL causes an immediate return, with
*supports_tls equal to 0.

Index: linux-2.6.22/arch/um/os-Linux/sys-i386/tls.c
===================================================================
--- linux-2.6.22.orig/arch/um/os-Linux/sys-i386/tls.c	2007-07-08 19:32:17.000000000 -0400
+++ linux-2.6.22/arch/um/os-Linux/sys-i386/tls.c	2008-08-26 08:19:37.000000000 -0400
@@ -15,6 +15,7 @@ void check_host_supports_tls(int *suppor
 	int val[] = {GDT_ENTRY_TLS_MIN_I386, GDT_ENTRY_TLS_MIN_X86_64};
 	int i;
 
+	*supports_tls = 0;
 	for (i = 0; i < ARRAY_SIZE(val); i++) {
 		user_desc_t info;
 		info.entry_number = val[i];
@@ -23,14 +24,9 @@ void check_host_supports_tls(int *suppor
 			*tls_min = val[i];
 			*supports_tls = 1;
 			return;
-		} else {
-			if (errno == EINVAL)
-				continue;
-			else if (errno == ENOSYS)
-				*supports_tls = 0;
-				return;
 		}
+		if (errno == EINVAL)
+			continue;
+		else return;
 	}
-
-	*supports_tls = 0;
 }

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

  reply	other threads:[~2008-08-26 16:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-19  6:09 [uml-devel] [RFC PATCH] uml: fix double statement if missing braces Ilpo Järvinen
2008-08-26 16:52 ` Jeff Dike [this message]
2008-08-27  9:34   ` Ilpo Järvinen
2008-08-27 15:09     ` Jeff Dike

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=20080826165222.GA18584@c2.user-mode-linux.org \
    --to=jdike@addtoit.com \
    --cc=ilpo.jarvinen@helsinki.fi \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).