All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] Audit return code :
@ 2005-06-21 10:18 Christophe Lucas
  2005-06-21 19:32 ` Alexey Dobriyan
  2005-06-22  7:07 ` Christophe Lucas
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe Lucas @ 2005-06-21 10:18 UTC (permalink / raw)
  To: kernel-janitors

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

description :
Audit return codes (and handle failure correctly) for misc_register.

Signed-off-by: Christophe Lucas <clucas@rotomalug.org>


[-- Attachment #2: patch_drivers_misc_hdpuftrs_hdpu_cpustate.c.diff --]
[-- Type: text/plain, Size: 974 bytes --]

diff -urpNX dontdiff 2.6.12-orig/drivers/misc/hdpuftrs/hdpu_cpustate.c 2.6.12/drivers/misc/hdpuftrs/hdpu_cpustate.c
--- 2.6.12-orig/drivers/misc/hdpuftrs/hdpu_cpustate.c	2005-06-17 21:48:29.000000000 +0200
+++ 2.6.12/drivers/misc/hdpuftrs/hdpu_cpustate.c	2005-06-21 11:38:33.783957664 +0200
@@ -192,12 +192,19 @@ static int hdpu_cpustate_probe(struct de
 {
 	struct platform_device *pdev = to_platform_device(ddev);
 	struct resource *res;
+	int ret;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	cpustate.set_addr = (unsigned long *)res->start;
 	cpustate.clr_addr = (unsigned long *)res->end - 1;
 
-	misc_register(&cpustate_dev);
+	if (ret = misc_register(&cpustate_dev)) {
+		printk(KERN_WARNING "Unable to register misc device.\n");
+		cpustate.set_addr = 0;
+		cpustate.clr_addr = 0;
+		return ret ;
+	}
+
 	create_proc_read_entry("sky_cpustate", 0, 0, cpustate_read_proc, NULL);
 
 	printk(KERN_INFO "Sky CPU State Driver v" SKY_CPUSTATE_VERSION "\n");

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] Audit return code :
  2005-06-21 10:18 [KJ] [PATCH] Audit return code : Christophe Lucas
@ 2005-06-21 19:32 ` Alexey Dobriyan
  2005-06-22  7:07 ` Christophe Lucas
  1 sibling, 0 replies; 3+ messages in thread
From: Alexey Dobriyan @ 2005-06-21 19:32 UTC (permalink / raw)
  To: kernel-janitors

On Tuesday 21 June 2005 14:18, Christophe Lucas wrote:
> Audit return codes (and handle failure correctly) for misc_register.

> --- 2.6.12-orig/drivers/misc/hdpuftrs/hdpu_cpustate.c
> +++ 2.6.12/drivers/misc/hdpuftrs/hdpu_cpustate.c
> @@ -192,12 +192,19 @@ static int hdpu_cpustate_probe(struct de
>  {
>  	struct platform_device *pdev = to_platform_device(ddev);
>  	struct resource *res;
> +	int ret;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	cpustate.set_addr = (unsigned long *)res->start;
>  	cpustate.clr_addr = (unsigned long *)res->end - 1;
>  
> -	misc_register(&cpustate_dev);
> +	if (ret = misc_register(&cpustate_dev)) {
> +		printk(KERN_WARNING "Unable to register misc device.\n");
> +		cpustate.set_addr = 0;
> +		cpustate.clr_addr = 0;

Why clear them? Anyway, both are pointers, so use NULL.

> +		return ret ;
> +	}
> +
>  	create_proc_read_entry("sky_cpustate", 0, 0, cpustate_read_proc, NULL);

Also unchecked.

Please, post patches inline.
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] Audit return code :
  2005-06-21 10:18 [KJ] [PATCH] Audit return code : Christophe Lucas
  2005-06-21 19:32 ` Alexey Dobriyan
@ 2005-06-22  7:07 ` Christophe Lucas
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe Lucas @ 2005-06-22  7:07 UTC (permalink / raw)
  To: kernel-janitors

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

Alexey Dobriyan (adobriyan@gmail.com) wrote:
> On Tuesday 21 June 2005 14:18, Christophe Lucas wrote:
> > Audit return codes (and handle failure correctly) for misc_register.
> 
> > --- 2.6.12-orig/drivers/misc/hdpuftrs/hdpu_cpustate.c
> > +++ 2.6.12/drivers/misc/hdpuftrs/hdpu_cpustate.c
> > @@ -192,12 +192,19 @@ static int hdpu_cpustate_probe(struct de
> >  {
> >  	struct platform_device *pdev = to_platform_device(ddev);
> >  	struct resource *res;
> > +	int ret;
> >  
> >  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >  	cpustate.set_addr = (unsigned long *)res->start;
> >  	cpustate.clr_addr = (unsigned long *)res->end - 1;
> >  
> > -	misc_register(&cpustate_dev);
> > +	if (ret = misc_register(&cpustate_dev)) {
> > +		printk(KERN_WARNING "Unable to register misc device.\n");
> > +		cpustate.set_addr = 0;
> > +		cpustate.clr_addr = 0;
> 
> Why clear them? Anyway, both are pointers, so use NULL.

I have cleared it as it is done in original file (line 209, 210).
But I will correct it in NULL form. Thanks,

> > +		return ret ;
> > +	}
> > +
> >  	create_proc_read_entry("sky_cpustate", 0, 0, cpustate_read_proc, NULL);
> 
> Also unchecked.
> 
> Please, post patches inline.

Ok, I will correct my configuration of mutt.

Thanks and have a nice day,

						- Christophe

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2005-06-22  7:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-21 10:18 [KJ] [PATCH] Audit return code : Christophe Lucas
2005-06-21 19:32 ` Alexey Dobriyan
2005-06-22  7:07 ` Christophe Lucas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.