lkml.org 
[lkml]   [2006]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] tlclk: fix platform_device_register_simple() error check
On Thu, Nov 23, 2006 at 03:41:11AM +0900, Akinobu Mita wrote:
> The return value of platform_device_register_simple() should be
> checked by IS_ERR().
>
> This patch also fix misc_register() error case. Because misc_register()
> returns error code.
>
> Cc: Sebastien Bouchard <sebastien.bouchard@ca.kontron.com>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
>
> ---
> drivers/char/tlclk.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> Index: work-fault-inject/drivers/char/tlclk.c
> ===================================================================
> --- work-fault-inject.orig/drivers/char/tlclk.c
> +++ work-fault-inject/drivers/char/tlclk.c
> @@ -792,15 +792,14 @@ static int __init tlclk_init(void)
> ret = misc_register(&tlclk_miscdev);
> if (ret < 0) {
> printk(KERN_ERR "tlclk: misc_register returns %d.\n", ret);
> - ret = -EBUSY;

results in an non-error return when there this device isn't on the
system.

* NAK *
> goto out3;
> }
>
> tlclk_device = platform_device_register_simple("telco_clock",
> -1, NULL, 0);
> - if (!tlclk_device) {
> + if (IS_ERR(tlclk_device)) {
ok

> printk(KERN_ERR "tlclk: platform_device_register failed.\n");
> - ret = -EBUSY;
> + ret = PTR_ERR(tlclk_device);

I don't know about this but I could be wrong. Please convince me.

> goto out4;
> }
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-11-27 21:43    [W:0.062 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site