leds: triggers: return error if invalid trigger name is provided via sysfs

If an invalid trigger name is provided via sysfs currently no error
is returned. Therefore it's not possible to determine whether the
trigger was set successfully.
Fix this by returning -EINVAL if no trigger is matched.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
This commit is contained in:
Heiner Kallweit 2016-07-01 23:08:54 +02:00 коммит произвёл Jacek Anaszewski
Родитель b1ae40a5db
Коммит a3eac76cdf
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -60,6 +60,8 @@ ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
goto unlock;
}
}
/* we come here only if buf matches no trigger */
ret = -EINVAL;
up_read(&triggers_list_lock);
unlock: