diff options
Diffstat (limited to 'drivers/leds/ledtrig-timer.c')
-rw-r--r-- | drivers/leds/ledtrig-timer.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c index 179c2876b541..29a8818a32ec 100644 --- a/drivers/leds/ledtrig-timer.c +++ b/drivers/leds/ledtrig-timer.c | |||
@@ -123,6 +123,7 @@ static CLASS_DEVICE_ATTR(delay_off, 0644, led_delay_off_show, | |||
123 | static void timer_trig_activate(struct led_classdev *led_cdev) | 123 | static void timer_trig_activate(struct led_classdev *led_cdev) |
124 | { | 124 | { |
125 | struct timer_trig_data *timer_data; | 125 | struct timer_trig_data *timer_data; |
126 | int rc; | ||
126 | 127 | ||
127 | timer_data = kzalloc(sizeof(struct timer_trig_data), GFP_KERNEL); | 128 | timer_data = kzalloc(sizeof(struct timer_trig_data), GFP_KERNEL); |
128 | if (!timer_data) | 129 | if (!timer_data) |
@@ -134,10 +135,21 @@ static void timer_trig_activate(struct led_classdev *led_cdev) | |||
134 | timer_data->timer.function = led_timer_function; | 135 | timer_data->timer.function = led_timer_function; |
135 | timer_data->timer.data = (unsigned long) led_cdev; | 136 | timer_data->timer.data = (unsigned long) led_cdev; |
136 | 137 | ||
137 | class_device_create_file(led_cdev->class_dev, | 138 | rc = class_device_create_file(led_cdev->class_dev, |
138 | &class_device_attr_delay_on); | 139 | &class_device_attr_delay_on); |
139 | class_device_create_file(led_cdev->class_dev, | 140 | if (rc) goto err_out; |
141 | rc = class_device_create_file(led_cdev->class_dev, | ||
140 | &class_device_attr_delay_off); | 142 | &class_device_attr_delay_off); |
143 | if (rc) goto err_out_delayon; | ||
144 | |||
145 | return; | ||
146 | |||
147 | err_out_delayon: | ||
148 | class_device_remove_file(led_cdev->class_dev, | ||
149 | &class_device_attr_delay_on); | ||
150 | err_out: | ||
151 | led_cdev->trigger_data = NULL; | ||
152 | kfree(timer_data); | ||
141 | } | 153 | } |
142 | 154 | ||
143 | static void timer_trig_deactivate(struct led_classdev *led_cdev) | 155 | static void timer_trig_deactivate(struct led_classdev *led_cdev) |