]> rtime.felk.cvut.cz Git - lincan.git/commitdiff
Use inode argument to obtain minor number even in extended close function. can-usb1
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Sat, 25 Jul 2015 21:27:01 +0000 (23:27 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Sat, 25 Jul 2015 21:27:01 +0000 (23:27 +0200)
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
lincan/src/close.c

index a4dfe120583acb74763dee2d4a3fcb679513b830..6a0ca6e0190578fc18b8adf5119a2bd525920ece 100644 (file)
@@ -49,13 +49,14 @@ int can_close(struct inode *inode, struct file *file)
        struct canque_ends_t *qends;
        struct msgobj_t *obj;
        can_spin_irqflags_t iflags;
+       int minor_nr = INODE2MINOR_NR(inode);
 
        if(!canuser || (canuser->magic != CAN_USER_MAGIC)){
                CANMSG("can_close: bad canuser magic\n");
                return -ENODEV;
        }
-       if ((chip=objects_p[MINOR_NR]->hostchip) == NULL) {
-               CANMSG("There is no hardware support for the device file with minor nr.: %d\n",MINOR_NR);
+       if ((chip=objects_p[minor_nr]->hostchip) == NULL) {
+               CANMSG("There is no hardware support for the device file with minor nr.: %d\n",minor_nr);
                return -ENODEV;
        }