Re: [PATCH] modules, small codingstyle cleanup, one statement/expression pr line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 19 Jun 2005, Jesper Juhl wrote:

> Small patch to make kernel/module.c a little more readable and a little 
> more CodingStyle conforming.
> 
> Signed-off-by: Jesper Juhl <[email protected]>
> ---
> 
>  kernel/module.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> --- linux-2.6.12-orig/kernel/module.c	2005-06-17 21:48:29.000000000 +0200
> +++ linux-2.6.12/kernel/module.c	2005-06-19 21:24:26.000000000 +0200
> @@ -1731,8 +1731,10 @@ static struct module *load_module(void _
>  	kfree(args);
>   free_hdr:
>  	vfree(hdr);
> -	if (err < 0) return ERR_PTR(err);
> -	else return ptr;
> +	if (err < 0)
> +		return ERR_PTR(err);
> +	else
> +		return ptr;
>  
>   truncated:
>  	printk(KERN_ERR "Module len %lu truncated\n", len);
> 
> 
Joe Perches suggested we use 

	if (err < 0)
		return ERR_PTR(err);
	return ptr;

instead.  The behaviour of the code is the same, but it is of course a bit 
shorter, so here's an alternative patch - pick the one you prefer.

Signed-off-by: Jesper Juhl <[email protected]>
---

--- linux-2.6.12-orig/kernel/module.c	2005-06-17 21:48:29.000000000 +0200
+++ linux-2.6.12/kernel/module.c	2005-06-19 22:48:41.000000000 +0200
@@ -1731,9 +1731,9 @@ static struct module *load_module(void _
 	kfree(args);
  free_hdr:
 	vfree(hdr);
-	if (err < 0) return ERR_PTR(err);
-	else return ptr;
-
+	if (err < 0)
+		return ERR_PTR(err);
+	return ptr;
  truncated:
 	printk(KERN_ERR "Module len %lu truncated\n", len);
 	err = -ENOEXEC;



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux