mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
UPSTREAM: [media] lirc_dev: clarify error handling
out_sysfs is misleading, sysfs only comes into play after device_add().
Also, calling device_init() before the rest of struct dev is filled out
is clearer.
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 2582322695)
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
This commit is contained in:
committed by
Tao Huang
parent
2ff4446867
commit
608eadb6ac
@@ -242,16 +242,16 @@ static int lirc_allocate_driver(struct lirc_driver *d)
|
||||
|
||||
ir->d = *d;
|
||||
|
||||
device_initialize(&ir->dev);
|
||||
ir->dev.devt = MKDEV(MAJOR(lirc_base_dev), ir->d.minor);
|
||||
ir->dev.class = lirc_class;
|
||||
ir->dev.parent = d->dev;
|
||||
ir->dev.release = lirc_release;
|
||||
dev_set_name(&ir->dev, "lirc%d", ir->d.minor);
|
||||
device_initialize(&ir->dev);
|
||||
|
||||
err = lirc_cdev_add(ir);
|
||||
if (err)
|
||||
goto out_sysfs;
|
||||
goto out_free_dev;
|
||||
|
||||
ir->attached = 1;
|
||||
|
||||
@@ -268,7 +268,7 @@ static int lirc_allocate_driver(struct lirc_driver *d)
|
||||
return minor;
|
||||
out_cdev:
|
||||
cdev_del(&ir->cdev);
|
||||
out_sysfs:
|
||||
out_free_dev:
|
||||
put_device(&ir->dev);
|
||||
out_lock:
|
||||
mutex_unlock(&lirc_dev_lock);
|
||||
|
||||
Reference in New Issue
Block a user