Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 20221
b: refs/heads/master
c: 1d30883
h: refs/heads/master
i:
  20219: 7acb72c
v: v3
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Feb 12, 2006
1 parent a18fc38 commit ba33485
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ef1bea9e2a5a72d2c3362522e0a09099406732ff
refs/heads/master: 1d30883942cfe8a1e3f88f8b7f4c292aeba3db5a
15 changes: 12 additions & 3 deletions trunk/drivers/char/tipar.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,17 @@ tipar_open(struct inode *inode, struct file *file)
{
unsigned int minor = iminor(inode) - TIPAR_MINOR;

if (minor > tp_count - 1)
if (tp_count == 0 || minor > tp_count - 1)
return -ENXIO;

if (test_and_set_bit(minor, &opened))
return -EBUSY;

if (!table[minor].dev) {
printk(KERN_ERR "%s: NULL device for minor %u\n",
__FUNCTION__, minor);
return -ENXIO;
}
parport_claim_or_block(table[minor].dev);
init_ti_parallel(minor);
parport_release(table[minor].dev);
Expand Down Expand Up @@ -510,16 +515,20 @@ tipar_init_module(void)
err = PTR_ERR(tipar_class);
goto out_chrdev;
}
if (parport_register_driver(&tipar_driver)) {
if (parport_register_driver(&tipar_driver) || tp_count == 0) {
printk(KERN_ERR "tipar: unable to register with parport\n");
err = -EIO;
goto out;
goto out_class;
}

err = 0;
goto out;

out_class:
class_destroy(tipar_class);

out_chrdev:
devfs_remove("ticables/par");
unregister_chrdev(TIPAR_MAJOR, "tipar");
out:
return err;
Expand Down

0 comments on commit ba33485

Please sign in to comment.