From 258232269590cee2acd4bb28b8e027ad340a85f9 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Mon, 1 May 2017 13:04:01 -0300 Subject: [media] lirc_dev: clarify error handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/lirc_dev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index a613970ce159..7d04f83c1ab6 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -238,16 +238,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; @@ -264,7 +264,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); -- cgit v1.2.3