2010-11-26 17:06:51

by Vasily Kulikov

[permalink] [raw]
Subject: [PATCH] media: rc: lirc_dev: check kobject_set_name() result

kobject_set_name() may fail with -ENOMEM, check for it.

Signed-off-by: Vasiliy Kulikov <[email protected]>
---
Compile tested only.

drivers/media/rc/lirc_dev.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index 8418b14..0a2d267 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -178,7 +178,9 @@ static int lirc_cdev_add(struct irctl *ir)
cdev_init(cdev, &lirc_dev_fops);
cdev->owner = THIS_MODULE;
}
- kobject_set_name(&cdev->kobj, "lirc%d", d->minor);
+ retval = kobject_set_name(&cdev->kobj, "lirc%d", d->minor);
+ if (retval)
+ return retval;

retval = cdev_add(cdev, MKDEV(MAJOR(lirc_base_dev), d->minor), 1);
if (retval)
--
1.7.0.4


2010-12-02 02:45:44

by Jarod Wilson

[permalink] [raw]
Subject: Re: [PATCH] media: rc: lirc_dev: check kobject_set_name() result

On Nov 26, 2010, at 12:06 PM, Vasiliy Kulikov wrote:

> kobject_set_name() may fail with -ENOMEM, check for it.
>
> Signed-off-by: Vasiliy Kulikov <[email protected]>
> ---
> Compile tested only.

Works for me.

Acked-by: Jarod Wilson <[email protected]>

--
Jarod Wilson
[email protected]