scst_sysfs: Save the value of the 'preferred' attribute only if it has been set

The default value of the 'preferred' attribute is 0 (disabled). Hence
it is only necessary that scstadmin saves the value of that attribute
if it is not zero.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5502 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2014-05-02 02:56:19 +00:00
parent 5bbff95426
commit d6a46f9d73

View File

@@ -5414,8 +5414,8 @@ static ssize_t scst_tg_preferred_show(struct kobject *kobj,
struct scst_target_group *tg;
tg = container_of(kobj, struct scst_target_group, kobj);
return scnprintf(buf, PAGE_SIZE, "%u\n%s",
tg->preferred, SCST_SYSFS_KEY_MARK "\n");
return scnprintf(buf, PAGE_SIZE, "%u\n%s", tg->preferred,
tg->preferred ? SCST_SYSFS_KEY_MARK "\n" : "");
}
static int scst_tg_preferred_store_work_fn(struct scst_sysfs_work_item *w)