lkml.org 
[lkml]   [2010]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] powerpc/BSR: fix device_create() return value check
On Thu, Mar 11, 2010 at 06:15:53PM +0200, Jani Nikula wrote:
> From: Jani Nikula <ext-jani.1.nikula@nokia.com>
>
> Use IS_ERR() instead of comparing to NULL.
>
> Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
>
> ---
>
> NOTE: I'm afraid I'm unable to test this; please consider this more a
> bug report than a complete patch.
> ---
> drivers/char/bsr.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c
> index c02db01..3b31f74 100644
> --- a/drivers/char/bsr.c
> +++ b/drivers/char/bsr.c
> @@ -252,7 +252,7 @@ static int bsr_add_node(struct device_node *bn)
>
> cur->bsr_device = device_create(bsr_class, NULL, cur->bsr_dev,
> cur, cur->bsr_name);
> - if (!cur->bsr_device) {
> + if (IS_ERR(cur->bsr_device)) {
> printk(KERN_ERR "device_create failed for %s\n",
> cur->bsr_name);
> cdev_del(&cur->bsr_cdev);
> --
> 1.6.5.2
>

This looks fine to me, good catch.

Acked-by: Sonny Rao <sonnyrao@us.ibm.com>



\
 
 \ /
  Last update: 2010-03-11 22:25    [W:0.113 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site