diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-07-05 03:29:00 -0400 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2010-08-03 09:49:11 -0400 |
commit | 45036ae14a0161e9a0f542b6cb7ed55790f73f5b (patch) | |
tree | 2228815a681ea456aef485ec06a0b081f17e4a3c | |
parent | 8700e1612e19f752be507f7fdcd8b48ba1b425ee (diff) |
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>
-rw-r--r-- | drivers/platform/x86/asus-laptop.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index 6aba24618416..b756e07d41b4 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c | |||
@@ -1124,7 +1124,7 @@ static int asus_input_init(struct asus_laptop *asus) | |||
1124 | input = input_allocate_device(); | 1124 | input = input_allocate_device(); |
1125 | if (!input) { | 1125 | if (!input) { |
1126 | pr_info("Unable to allocate input device\n"); | 1126 | pr_info("Unable to allocate input device\n"); |
1127 | return 0; | 1127 | return -ENOMEM; |
1128 | } | 1128 | } |
1129 | input->name = "Asus Laptop extra buttons"; | 1129 | input->name = "Asus Laptop extra buttons"; |
1130 | input->phys = ASUS_LAPTOP_FILE "/input0"; | 1130 | input->phys = ASUS_LAPTOP_FILE "/input0"; |
@@ -1135,20 +1135,20 @@ static int asus_input_init(struct asus_laptop *asus) | |||
1135 | error = sparse_keymap_setup(input, asus_keymap, NULL); | 1135 | error = sparse_keymap_setup(input, asus_keymap, NULL); |
1136 | if (error) { | 1136 | if (error) { |
1137 | pr_err("Unable to setup input device keymap\n"); | 1137 | pr_err("Unable to setup input device keymap\n"); |
1138 | goto err_keymap; | 1138 | goto err_free_dev; |
1139 | } | 1139 | } |
1140 | error = input_register_device(input); | 1140 | error = input_register_device(input); |
1141 | if (error) { | 1141 | if (error) { |
1142 | pr_info("Unable to register input device\n"); | 1142 | pr_info("Unable to register input device\n"); |
1143 | goto err_device; | 1143 | goto err_free_keymap; |
1144 | } | 1144 | } |
1145 | 1145 | ||
1146 | asus->inputdev = input; | 1146 | asus->inputdev = input; |
1147 | return 0; | 1147 | return 0; |
1148 | 1148 | ||
1149 | err_keymap: | 1149 | err_free_keymap: |
1150 | sparse_keymap_free(input); | 1150 | sparse_keymap_free(input); |
1151 | err_device: | 1151 | err_free_dev: |
1152 | input_free_device(input); | 1152 | input_free_device(input); |
1153 | return error; | 1153 | return error; |
1154 | } | 1154 | } |