- if ( ((obj=objects_p[MINOR_NR]) == NULL) ||
- ((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 ((minor_nr < 0) || (minor_nr >= MAX_TOT_MSGOBJS)) {
+ CANMSG("can_open: bad minor %d\n", minor_nr);
+ return -ENODEV;
+ }
+
+ if ( ((obj=objects_p[minor_nr]) == NULL) ||
+ ((chip=objects_p[minor_nr]->hostchip) == NULL) ) {
+ CANMSG("There is no hardware support for the device file with minor nr.: %d\n", minor_nr);