From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> Date: Tue, 7 Feb 2017 20:08:04 +0100 * Return an error code without storing it in an intermediate variable. * Delete the local variable "err" and the jump label "out" which became unnecessary with this refactoring. Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> --- drivers/hid/hid-debug.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index 444c63f0e4be..60984e2906a7 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c @@ -1079,22 +1079,18 @@ static int hid_debug_rdesc_open(struct inode *inode, struct file *file) static int hid_debug_events_open(struct inode *inode, struct file *file) { - int err = 0; struct hid_debug_list *list; unsigned long flags; list = kzalloc(sizeof(*list), GFP_KERNEL); - if (!list) { - err = -ENOMEM; - goto out; - } + if (!list) + return -ENOMEM; list->hid_debug_buf = kzalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_KERNEL); if (!list->hid_debug_buf) { - err = -ENOMEM; kfree(list); - goto out; + return -ENOMEM; } list->hdev = (struct hid_device *) inode->i_private; file->private_data = list; @@ -1103,9 +1099,7 @@ static int hid_debug_events_open(struct inode *inode, struct file *file) spin_lock_irqsave(&list->hdev->debug_list_lock, flags); list_add_tail(&list->node, &list->hdev->debug_list); spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); - -out: - return err; + return 0; } static ssize_t hid_debug_events_read(struct file *file, char __user *buffer, -- 2.11.1 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html