Skip to content

Commit

Permalink
ppdev: ppdev_init: do not return zero in case of failure
Browse files Browse the repository at this point in the history
Error handling of parport_register_driver() in ppdev_init()
is broken because it deallocates all resources but still
returns zero.

Currently parport_register_driver() always succeeds.
Nevertheless it is worth to fix the issue.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Alexey Khoroshilov authored and Greg Kroah-Hartman committed Sep 5, 2012
1 parent 0bf5a8b commit 9a32bb3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/char/ppdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,8 @@ static int __init ppdev_init (void)
err = PTR_ERR(ppdev_class);
goto out_chrdev;
}
if (parport_register_driver(&pp_driver)) {
err = parport_register_driver(&pp_driver);
if (err < 0) {
printk (KERN_WARNING CHRDEV ": unable to register with parport\n");
goto out_class;
}
Expand Down

0 comments on commit 9a32bb3

Please sign in to comment.