From d6a46f9d73a72a49dd2728b3bcd02c03b2f10ca5 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 2 May 2014 02:56:19 +0000 Subject: [PATCH] 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 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5502 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index 8ca303484..a6bda65bd 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -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)