Commit 0ea92c50 authored by Wei Yongjun's avatar Wei Yongjun Committed by Mauro Carvalho Chehab

[media] staging: lirc: add missing platform_device_del() on error

Add the missing platform_device_del() before return from
lirc_parallel_init() in the error handling case.
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
parent 4a86bc10
...@@ -650,7 +650,7 @@ static int __init lirc_parallel_init(void) ...@@ -650,7 +650,7 @@ static int __init lirc_parallel_init(void)
if (!pport) { if (!pport) {
pr_notice("no port at %x found\n", io); pr_notice("no port at %x found\n", io);
result = -ENXIO; result = -ENXIO;
goto exit_device_put; goto exit_device_del;
} }
ppdevice = parport_register_device(pport, LIRC_DRIVER_NAME, ppdevice = parport_register_device(pport, LIRC_DRIVER_NAME,
pf, kf, lirc_lirc_irq_handler, 0, pf, kf, lirc_lirc_irq_handler, 0,
...@@ -659,7 +659,7 @@ static int __init lirc_parallel_init(void) ...@@ -659,7 +659,7 @@ static int __init lirc_parallel_init(void)
if (!ppdevice) { if (!ppdevice) {
pr_notice("parport_register_device() failed\n"); pr_notice("parport_register_device() failed\n");
result = -ENXIO; result = -ENXIO;
goto exit_device_put; goto exit_device_del;
} }
if (parport_claim(ppdevice) != 0) if (parport_claim(ppdevice) != 0)
goto skip_init; goto skip_init;
...@@ -678,7 +678,7 @@ static int __init lirc_parallel_init(void) ...@@ -678,7 +678,7 @@ static int __init lirc_parallel_init(void)
parport_release(pport); parport_release(pport);
parport_unregister_device(ppdevice); parport_unregister_device(ppdevice);
result = -EIO; result = -EIO;
goto exit_device_put; goto exit_device_del;
} }
#endif #endif
...@@ -695,11 +695,13 @@ static int __init lirc_parallel_init(void) ...@@ -695,11 +695,13 @@ static int __init lirc_parallel_init(void)
pr_notice("register_chrdev() failed\n"); pr_notice("register_chrdev() failed\n");
parport_unregister_device(ppdevice); parport_unregister_device(ppdevice);
result = -EIO; result = -EIO;
goto exit_device_put; goto exit_device_del;
} }
pr_info("installed using port 0x%04x irq %d\n", io, irq); pr_info("installed using port 0x%04x irq %d\n", io, irq);
return 0; return 0;
exit_device_del:
platform_device_del(lirc_parallel_dev);
exit_device_put: exit_device_put:
platform_device_put(lirc_parallel_dev); platform_device_put(lirc_parallel_dev);
exit_driver_unregister: exit_driver_unregister:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment