- if ( !( base = (long) ioremap( io_addr, IO_RANGE ) ) ) {
- CANMSG("Unable to access I/O memory at: 0x%lx\n", io_addr);
+ if (!can_request_mem_region(candev->io_addr,IO_RANGE,DEVICE_NAME)) {
+ CANMSG("Unable to request IO-memory: 0x%lx\n",candev->io_addr);
+ return -ENODEV;
+ }
+
+ if ( !( base = (long) ioremap( candev->io_addr, IO_RANGE ) ) ) {
+ CANMSG("Unable to access I/O memory at: 0x%lx\n", candev->io_addr);
+ can_release_mem_region(candev->io_addr,IO_RANGE);