diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2014-09-23 12:08:05 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-10-01 03:11:22 -0400 |
commit | 7fefeec5176861c2747b8dcd9656acf42c288ded (patch) | |
tree | 79c18a31d02390892d6fe75b4d89edcc422e903d | |
parent | 8ffffd5212846b72f116f7a9572e83d580e25802 (diff) |
HID: wacom: rename failN with some meaningful information
When we have to deal with new elements in probe, having the exit labels
named sequencially is a pain to maintain. Put a meaningful name instead
so that we do not have to renumber them on inserts.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/wacom_sys.c | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 25086287957e..97e1feffc6e4 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -1075,7 +1075,7 @@ static int wacom_register_inputs(struct wacom *wacom) | |||
1075 | pad_input_dev = wacom_allocate_input(wacom); | 1075 | pad_input_dev = wacom_allocate_input(wacom); |
1076 | if (!input_dev || !pad_input_dev) { | 1076 | if (!input_dev || !pad_input_dev) { |
1077 | error = -ENOMEM; | 1077 | error = -ENOMEM; |
1078 | goto fail1; | 1078 | goto fail_allocate_input; |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | wacom_wac->input = input_dev; | 1081 | wacom_wac->input = input_dev; |
@@ -1084,11 +1084,11 @@ static int wacom_register_inputs(struct wacom *wacom) | |||
1084 | 1084 | ||
1085 | error = wacom_setup_input_capabilities(input_dev, wacom_wac); | 1085 | error = wacom_setup_input_capabilities(input_dev, wacom_wac); |
1086 | if (error) | 1086 | if (error) |
1087 | goto fail2; | 1087 | goto fail_input_cap; |
1088 | 1088 | ||
1089 | error = input_register_device(input_dev); | 1089 | error = input_register_device(input_dev); |
1090 | if (error) | 1090 | if (error) |
1091 | goto fail2; | 1091 | goto fail_register_input; |
1092 | 1092 | ||
1093 | error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac); | 1093 | error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac); |
1094 | if (error) { | 1094 | if (error) { |
@@ -1099,25 +1099,26 @@ static int wacom_register_inputs(struct wacom *wacom) | |||
1099 | } else { | 1099 | } else { |
1100 | error = input_register_device(pad_input_dev); | 1100 | error = input_register_device(pad_input_dev); |
1101 | if (error) | 1101 | if (error) |
1102 | goto fail3; | 1102 | goto fail_register_pad_input; |
1103 | 1103 | ||
1104 | error = wacom_initialize_leds(wacom); | 1104 | error = wacom_initialize_leds(wacom); |
1105 | if (error) | 1105 | if (error) |
1106 | goto fail4; | 1106 | goto fail_leds; |
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | return 0; | 1109 | return 0; |
1110 | 1110 | ||
1111 | fail4: | 1111 | fail_leds: |
1112 | input_unregister_device(pad_input_dev); | 1112 | input_unregister_device(pad_input_dev); |
1113 | pad_input_dev = NULL; | 1113 | pad_input_dev = NULL; |
1114 | fail3: | 1114 | fail_register_pad_input: |
1115 | input_unregister_device(input_dev); | 1115 | input_unregister_device(input_dev); |
1116 | input_dev = NULL; | 1116 | input_dev = NULL; |
1117 | fail2: | 1117 | fail_register_input: |
1118 | fail_input_cap: | ||
1118 | wacom_wac->input = NULL; | 1119 | wacom_wac->input = NULL; |
1119 | wacom_wac->pad_input = NULL; | 1120 | wacom_wac->pad_input = NULL; |
1120 | fail1: | 1121 | fail_allocate_input: |
1121 | if (input_dev) | 1122 | if (input_dev) |
1122 | input_free_device(input_dev); | 1123 | input_free_device(input_dev); |
1123 | if (pad_input_dev) | 1124 | if (pad_input_dev) |
@@ -1305,7 +1306,7 @@ static int wacom_probe(struct hid_device *hdev, | |||
1305 | error = hid_parse(hdev); | 1306 | error = hid_parse(hdev); |
1306 | if (error) { | 1307 | if (error) { |
1307 | hid_err(hdev, "parse failed\n"); | 1308 | hid_err(hdev, "parse failed\n"); |
1308 | goto fail1; | 1309 | goto fail_parse; |
1309 | } | 1310 | } |
1310 | 1311 | ||
1311 | wacom_wac = &wacom->wacom_wac; | 1312 | wacom_wac = &wacom->wacom_wac; |
@@ -1314,12 +1315,12 @@ static int wacom_probe(struct hid_device *hdev, | |||
1314 | features->pktlen = wacom_compute_pktlen(hdev); | 1315 | features->pktlen = wacom_compute_pktlen(hdev); |
1315 | if (features->pktlen > WACOM_PKGLEN_MAX) { | 1316 | if (features->pktlen > WACOM_PKGLEN_MAX) { |
1316 | error = -EINVAL; | 1317 | error = -EINVAL; |
1317 | goto fail1; | 1318 | goto fail_pktlen; |
1318 | } | 1319 | } |
1319 | 1320 | ||
1320 | if (features->check_for_hid_type && features->hid_type != hdev->type) { | 1321 | if (features->check_for_hid_type && features->hid_type != hdev->type) { |
1321 | error = -ENODEV; | 1322 | error = -ENODEV; |
1322 | goto fail1; | 1323 | goto fail_type; |
1323 | } | 1324 | } |
1324 | 1325 | ||
1325 | wacom->usbdev = dev; | 1326 | wacom->usbdev = dev; |
@@ -1388,20 +1389,20 @@ static int wacom_probe(struct hid_device *hdev, | |||
1388 | 1389 | ||
1389 | error = wacom_add_shared_data(hdev); | 1390 | error = wacom_add_shared_data(hdev); |
1390 | if (error) | 1391 | if (error) |
1391 | goto fail1; | 1392 | goto fail_shared_data; |
1392 | } | 1393 | } |
1393 | 1394 | ||
1394 | if (!(features->quirks & WACOM_QUIRK_MONITOR) && | 1395 | if (!(features->quirks & WACOM_QUIRK_MONITOR) && |
1395 | (features->quirks & WACOM_QUIRK_BATTERY)) { | 1396 | (features->quirks & WACOM_QUIRK_BATTERY)) { |
1396 | error = wacom_initialize_battery(wacom); | 1397 | error = wacom_initialize_battery(wacom); |
1397 | if (error) | 1398 | if (error) |
1398 | goto fail2; | 1399 | goto fail_battery; |
1399 | } | 1400 | } |
1400 | 1401 | ||
1401 | if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { | 1402 | if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { |
1402 | error = wacom_register_inputs(wacom); | 1403 | error = wacom_register_inputs(wacom); |
1403 | if (error) | 1404 | if (error) |
1404 | goto fail3; | 1405 | goto fail_register_inputs; |
1405 | } | 1406 | } |
1406 | 1407 | ||
1407 | if (hdev->bus == BUS_BLUETOOTH) { | 1408 | if (hdev->bus == BUS_BLUETOOTH) { |
@@ -1419,7 +1420,7 @@ static int wacom_probe(struct hid_device *hdev, | |||
1419 | error = hid_hw_start(hdev, HID_CONNECT_HIDRAW); | 1420 | error = hid_hw_start(hdev, HID_CONNECT_HIDRAW); |
1420 | if (error) { | 1421 | if (error) { |
1421 | hid_err(hdev, "hw start failed\n"); | 1422 | hid_err(hdev, "hw start failed\n"); |
1422 | goto fail4; | 1423 | goto fail_hw_start; |
1423 | } | 1424 | } |
1424 | 1425 | ||
1425 | if (features->quirks & WACOM_QUIRK_MONITOR) | 1426 | if (features->quirks & WACOM_QUIRK_MONITOR) |
@@ -1432,12 +1433,20 @@ static int wacom_probe(struct hid_device *hdev, | |||
1432 | 1433 | ||
1433 | return 0; | 1434 | return 0; |
1434 | 1435 | ||
1435 | fail4: if (hdev->bus == BUS_BLUETOOTH) | 1436 | fail_hw_start: |
1437 | wacom_unregister_inputs(wacom); | ||
1438 | if (hdev->bus == BUS_BLUETOOTH) | ||
1436 | device_remove_file(&hdev->dev, &dev_attr_speed); | 1439 | device_remove_file(&hdev->dev, &dev_attr_speed); |
1440 | fail_register_inputs: | ||
1437 | wacom_unregister_inputs(wacom); | 1441 | wacom_unregister_inputs(wacom); |
1438 | fail3: wacom_destroy_battery(wacom); | 1442 | wacom_destroy_battery(wacom); |
1439 | fail2: wacom_remove_shared_data(wacom_wac); | 1443 | fail_battery: |
1440 | fail1: kfree(wacom); | 1444 | wacom_remove_shared_data(wacom_wac); |
1445 | fail_shared_data: | ||
1446 | fail_type: | ||
1447 | fail_pktlen: | ||
1448 | fail_parse: | ||
1449 | kfree(wacom); | ||
1441 | hid_set_drvdata(hdev, NULL); | 1450 | hid_set_drvdata(hdev, NULL); |
1442 | return error; | 1451 | return error; |
1443 | } | 1452 | } |