aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/asus-laptop.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/asus-laptop.c')
-rw-r--r--drivers/misc/asus-laptop.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index 63953fe03320..d0fc4fd212e6 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -1072,19 +1072,16 @@ static void asus_backlight_exit(void)
1072} 1072}
1073 1073
1074#define ASUS_LED_UNREGISTER(object) \ 1074#define ASUS_LED_UNREGISTER(object) \
1075 if(object##_led.class_dev \ 1075 led_classdev_unregister(&object##_led)
1076 && !IS_ERR(object##_led.class_dev)) \
1077 led_classdev_unregister(&object##_led)
1078 1076
1079static void asus_led_exit(void) 1077static void asus_led_exit(void)
1080{ 1078{
1079 destroy_workqueue(led_workqueue);
1081 ASUS_LED_UNREGISTER(mled); 1080 ASUS_LED_UNREGISTER(mled);
1082 ASUS_LED_UNREGISTER(tled); 1081 ASUS_LED_UNREGISTER(tled);
1083 ASUS_LED_UNREGISTER(pled); 1082 ASUS_LED_UNREGISTER(pled);
1084 ASUS_LED_UNREGISTER(rled); 1083 ASUS_LED_UNREGISTER(rled);
1085 ASUS_LED_UNREGISTER(gled); 1084 ASUS_LED_UNREGISTER(gled);
1086
1087 destroy_workqueue(led_workqueue);
1088} 1085}
1089 1086
1090static void __exit asus_laptop_exit(void) 1087static void __exit asus_laptop_exit(void)
@@ -1140,29 +1137,42 @@ static int asus_led_init(struct device *dev)
1140 1137
1141 rv = ASUS_LED_REGISTER(mled, dev); 1138 rv = ASUS_LED_REGISTER(mled, dev);
1142 if (rv) 1139 if (rv)
1143 return rv; 1140 goto out;
1144 1141
1145 rv = ASUS_LED_REGISTER(tled, dev); 1142 rv = ASUS_LED_REGISTER(tled, dev);
1146 if (rv) 1143 if (rv)
1147 return rv; 1144 goto out1;
1148 1145
1149 rv = ASUS_LED_REGISTER(rled, dev); 1146 rv = ASUS_LED_REGISTER(rled, dev);
1150 if (rv) 1147 if (rv)
1151 return rv; 1148 goto out2;
1152 1149
1153 rv = ASUS_LED_REGISTER(pled, dev); 1150 rv = ASUS_LED_REGISTER(pled, dev);
1154 if (rv) 1151 if (rv)
1155 return rv; 1152 goto out3;
1156 1153
1157 rv = ASUS_LED_REGISTER(gled, dev); 1154 rv = ASUS_LED_REGISTER(gled, dev);
1158 if (rv) 1155 if (rv)
1159 return rv; 1156 goto out4;
1160 1157
1161 led_workqueue = create_singlethread_workqueue("led_workqueue"); 1158 led_workqueue = create_singlethread_workqueue("led_workqueue");
1162 if (!led_workqueue) 1159 if (!led_workqueue)
1163 return -ENOMEM; 1160 goto out5;
1164 1161
1165 return 0; 1162 return 0;
1163out5:
1164 rv = -ENOMEM;
1165 ASUS_LED_UNREGISTER(gled);
1166out4:
1167 ASUS_LED_UNREGISTER(pled);
1168out3:
1169 ASUS_LED_UNREGISTER(rled);
1170out2:
1171 ASUS_LED_UNREGISTER(tled);
1172out1:
1173 ASUS_LED_UNREGISTER(mled);
1174out:
1175 return rv;
1166} 1176}
1167 1177
1168static int __init asus_laptop_init(void) 1178static int __init asus_laptop_init(void)