From 8d00c6a6fb54334dcdf5254d1341fc9ccc8bb3bb Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Sat, 25 Jul 2015 23:27:01 +0200 Subject: [PATCH] Use inode argument to obtain minor number even in extended close function. Signed-off-by: Pavel Pisa --- lincan/src/close.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lincan/src/close.c b/lincan/src/close.c index a4dfe12..6a0ca6e 100644 --- a/lincan/src/close.c +++ b/lincan/src/close.c @@ -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; } -- 2.39.2