Commit 45036ae14a0161e9a0f542b6cb7ed55790f73f5b
Committed by
Matthew Garrett
1 parent
8700e1612e
Exists in
master
and in
7 other branches
asus-laptop: fix asus_input_init error path
This patch includes below fixes: 1. return -ENOMEM instead of 0 if input_allocate_device fail. 2. fix wrong goto if sparse_keymap_setup fail. 3. fix wrong goto if input_register_device fail. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Showing 1 changed file with 5 additions and 5 deletions Side-by-side Diff
drivers/platform/x86/asus-laptop.c
... | ... | @@ -1124,7 +1124,7 @@ |
1124 | 1124 | input = input_allocate_device(); |
1125 | 1125 | if (!input) { |
1126 | 1126 | pr_info("Unable to allocate input device\n"); |
1127 | - return 0; | |
1127 | + return -ENOMEM; | |
1128 | 1128 | } |
1129 | 1129 | input->name = "Asus Laptop extra buttons"; |
1130 | 1130 | input->phys = ASUS_LAPTOP_FILE "/input0"; |
1131 | 1131 | |
1132 | 1132 | |
1133 | 1133 | |
... | ... | @@ -1135,20 +1135,20 @@ |
1135 | 1135 | error = sparse_keymap_setup(input, asus_keymap, NULL); |
1136 | 1136 | if (error) { |
1137 | 1137 | pr_err("Unable to setup input device keymap\n"); |
1138 | - goto err_keymap; | |
1138 | + goto err_free_dev; | |
1139 | 1139 | } |
1140 | 1140 | error = input_register_device(input); |
1141 | 1141 | if (error) { |
1142 | 1142 | pr_info("Unable to register input device\n"); |
1143 | - goto err_device; | |
1143 | + goto err_free_keymap; | |
1144 | 1144 | } |
1145 | 1145 | |
1146 | 1146 | asus->inputdev = input; |
1147 | 1147 | return 0; |
1148 | 1148 | |
1149 | -err_keymap: | |
1149 | +err_free_keymap: | |
1150 | 1150 | sparse_keymap_free(input); |
1151 | -err_device: | |
1151 | +err_free_dev: | |
1152 | 1152 | input_free_device(input); |
1153 | 1153 | return error; |
1154 | 1154 | } |