On Tue, Jul 21, 2015 at 03:07:14PM -0400, Stephen Chandler Paul wrote: > +#define ps2emu_warn(format, args...) \ > + dev_warn(ps2emu_misc.this_device, format, ## args)
Don't make a wrapper function for another wrapper function, just spell the thing out in the code, makes it much easier to debug and maintain over time. It will also cause you to rename "this_device" to "dev" to make it easier to type :) > +static int ps2emu_char_open(struct inode *inode, struct file *file) > +{ > + struct ps2emu_device *ps2emu = NULL; > + > + ps2emu = kzalloc(sizeof(struct ps2emu_device), GFP_KERNEL); > + if (!ps2emu) > + return -ENOMEM; > + > + init_waitqueue_head(&ps2emu->waitq); > + > + ps2emu->serio.write = ps2emu_device_write; > + ps2emu->serio.port_data = ps2emu; > + > + file->private_data = ps2emu; > + > + nonseekable_open(inode, file); Why call this at all? > + ret = copy_to_user(buffer, &ps2emu->buf[ps2emu->tail], copylen); > + if (ret) > + return ret; Wrong error value, please return -EFAULT. > + rc = copy_from_user(&cmd, buffer, sizeof(cmd)); > + if (rc) > + return rc; Same thing here, -EFAULT. > + case PS2EMU_CMD_SEND_INTERRUPT: > + if (unlikely(!ps2emu->running)) { Unless you can verify likely/unlikely actually makes a difference in your code, don't ever use it. Hint, it's not needed here. thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/