From 7cf0816360102514ceb0ec863d2ac7728cc2ed78 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Thu, 16 Dec 2010 21:00:26 +0000 Subject: [PATCH] Reverted r3077: let's not confuse booleans and integers. I've seen enough subtlehard to track bugs from it. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3117 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_mem.c | 2 +- scst/src/scst_sysfs.c | 188 +++++++++++++++++++++--------------------- 2 files changed, 95 insertions(+), 95 deletions(-) diff --git a/scst/src/scst_mem.c b/scst/src/scst_mem.c index c5139cf74..c9787684c 100644 --- a/scst/src/scst_mem.c +++ b/scst/src/scst_mem.c @@ -2058,7 +2058,7 @@ static int scst_sgv_sysfs_create(struct sgv_pool *pool) res = kobject_init_and_add(&pool->sgv_kobj, &sgv_pool_ktype, scst_sgv_kobj, pool->name); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add sgv pool %s to sysfs", pool->name); goto out; } diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index cbf686ecd..3d8810dda 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -802,7 +802,7 @@ static ssize_t scst_tgtt_trace_level_store(struct kobject *kobj, tgtt = container_of(kobj, struct scst_tgt_template, tgtt_kobj); res = mutex_lock_interruptible(&scst_log_mutex); - if (res) + if (res != 0) goto out; res = scst_write_trace(buf, count, tgtt->trace_flags, @@ -948,7 +948,7 @@ static ssize_t scst_tgtt_mgmt_store(struct kobject *kobj, } res = scst_alloc_sysfs_work(scst_tgtt_mgmt_store_work_fn, false, &work); - if (res) + if (res != 0) goto out_free; work->buf = buffer; @@ -979,7 +979,7 @@ int scst_tgtt_sysfs_create(struct scst_tgt_template *tgtt) res = kobject_init_and_add(&tgtt->tgtt_kobj, &tgtt_ktype, scst_targets_kobj, tgtt->name); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add tgtt %s to sysfs", tgtt->name); goto out; } @@ -987,7 +987,7 @@ int scst_tgtt_sysfs_create(struct scst_tgt_template *tgtt) if (tgtt->add_target != NULL) { res = sysfs_create_file(&tgtt->tgtt_kobj, &scst_tgtt_mgmt.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add mgmt attr for target driver %s", tgtt->name); goto out_del; @@ -996,7 +996,7 @@ int scst_tgtt_sysfs_create(struct scst_tgt_template *tgtt) if (tgtt->tgtt_attrs) { res = sysfs_create_files(&tgtt->tgtt_kobj, tgtt->tgtt_attrs); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add attributes for target " "driver %s", tgtt->name); goto out_del; @@ -1007,7 +1007,7 @@ int scst_tgtt_sysfs_create(struct scst_tgt_template *tgtt) if (tgtt->trace_flags != NULL) { res = sysfs_create_file(&tgtt->tgtt_kobj, &tgtt_trace_attr.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add trace_flag for target " "driver %s", tgtt->name); goto out_del; @@ -1119,11 +1119,11 @@ static int __scst_process_luns_mgmt_store(char *buffer, } res = scst_suspend_activity(true); - if (res) + if (res != 0) goto out; res = mutex_lock_interruptible(&scst_mutex); - if (res) + if (res != 0) goto out_resume; /* Check if tgt and acg not already freed while we were coming here */ @@ -1211,7 +1211,7 @@ static int __scst_process_luns_mgmt_store(char *buffer, } res = strict_strtoul(pp, 0, &val); - if (res) { + if (res != 0) { PRINT_ERROR("strict_strtoul() for %s failed: %d " "(device %s)", pp, res, dev->virt_name); goto out_unlock; @@ -1247,7 +1247,7 @@ static int __scst_process_luns_mgmt_store(char *buffer, /* Replace */ res = scst_acg_del_lun(acg, acg_dev->lun, false); - if (res) + if (res != 0) goto out_unlock; dev_replaced = true; @@ -1257,7 +1257,7 @@ static int __scst_process_luns_mgmt_store(char *buffer, res = scst_acg_add_lun(acg, tgt_kobj ? tgt->tgt_luns_kobj : acg->luns_kobj, dev, virt_lun, read_only, !dev_replaced, NULL); - if (res) + if (res != 0) goto out_unlock; if (dev_replaced) { @@ -1283,7 +1283,7 @@ static int __scst_process_luns_mgmt_store(char *buffer, virt_lun = simple_strtoul(p, &p, 0); res = scst_acg_del_lun(acg, virt_lun, true); - if (res) + if (res != 0) goto out_unlock; break; case SCST_LUN_ACTION_CLEAR: @@ -1295,7 +1295,7 @@ static int __scst_process_luns_mgmt_store(char *buffer, res = scst_acg_del_lun(acg, acg_dev->lun, list_is_last(&acg_dev->acg_dev_list_entry, &acg->acg_dev_list)); - if (res) + if (res != 0) goto out_unlock; } break; @@ -1337,7 +1337,7 @@ static ssize_t __scst_acg_mgmt_store(struct scst_acg *acg, } res = scst_alloc_sysfs_work(sysfs_work_fn, false, &work); - if (res) + if (res != 0) goto out_free; work->buf = buffer; @@ -1519,11 +1519,11 @@ static int __scst_acg_process_io_grouping_type_store(struct scst_tgt *tgt, io_grouping_type); res = scst_suspend_activity(true); - if (res) + if (res != 0) goto out; res = mutex_lock_interruptible(&scst_mutex); - if (res) + if (res != 0) goto out_resume; /* Check if tgt and acg not already freed while we were coming here */ @@ -1577,7 +1577,7 @@ static ssize_t __scst_acg_io_grouping_type_store(struct scst_acg *acg, io_grouping_type = SCST_IO_GROUPING_NEVER; else { res = strict_strtol(buf, 0, &io_grouping_type); - if (res || io_grouping_type <= 0) { + if ((res != 0) || (io_grouping_type <= 0)) { PRINT_ERROR("Unknown or not allowed I/O grouping type " "%s", buf); res = -EINVAL; @@ -1590,7 +1590,7 @@ static ssize_t __scst_acg_io_grouping_type_store(struct scst_acg *acg, res = scst_alloc_sysfs_work(__scst_acg_io_grouping_type_store_work_fn, false, &work); - if (res) + if (res != 0) goto out; work->tgt = acg->tgt; @@ -1626,7 +1626,7 @@ static ssize_t scst_tgt_io_grouping_type_store(struct kobject *kobj, acg = tgt->default_acg; res = __scst_acg_io_grouping_type_store(acg, buf, count); - if (res) + if (res != 0) goto out; res = count; @@ -1667,7 +1667,7 @@ static int __scst_acg_process_cpu_mask_store(struct scst_tgt *tgt, TRACE_DBG("tgt %p, acg %p", tgt, acg); res = mutex_lock_interruptible(&scst_mutex); - if (res) + if (res != 0) goto out; /* Check if tgt and acg not already freed while we were coming here */ @@ -1744,7 +1744,7 @@ static ssize_t __scst_acg_cpu_mask_store(struct scst_acg *acg, res = scst_alloc_sysfs_work(__scst_acg_cpu_mask_store_work_fn, false, &work); - if (res) + if (res != 0) goto out; /* @@ -1753,7 +1753,7 @@ static ssize_t __scst_acg_cpu_mask_store(struct scst_acg *acg, */ res = __bitmap_parse(buf, count, 0, cpumask_bits(&work->cpu_mask), nr_cpumask_bits); - if (res) { + if (res != 0) { PRINT_ERROR("__bitmap_parse() failed: %d", res); goto out_release; } @@ -1797,7 +1797,7 @@ static ssize_t scst_tgt_cpu_mask_store(struct kobject *kobj, acg = tgt->default_acg; res = __scst_acg_cpu_mask_store(acg, buf, count); - if (res) + if (res != 0) goto out; res = count; @@ -1853,11 +1853,11 @@ static int scst_process_ini_group_mgmt_store(char *buffer, } res = scst_suspend_activity(true); - if (res) + if (res != 0) goto out; res = mutex_lock_interruptible(&scst_mutex); - if (res) + if (res != 0) goto out_resume; /* Check if our pointer is still alive */ @@ -1952,7 +1952,7 @@ static ssize_t scst_ini_group_mgmt_store(struct kobject *kobj, res = scst_alloc_sysfs_work(scst_ini_group_mgmt_store_work_fn, false, &work); - if (res) + if (res != 0) goto out_free; work->buf = buffer; @@ -2007,7 +2007,7 @@ static int scst_process_tgt_enable_store(struct scst_tgt *tgt, bool enable) if (enable) { if (tgt->rel_tgt_id == 0) { res = gen_relative_target_port_id(&tgt->rel_tgt_id); - if (res) + if (res != 0) goto out_put; PRINT_INFO("Using autogenerated rel ID %d for target " "%s", tgt->rel_tgt_id, tgt->tgt_name); @@ -2070,7 +2070,7 @@ static ssize_t scst_tgt_enable_store(struct kobject *kobj, res = scst_alloc_sysfs_work(scst_tgt_enable_store_work_fn, false, &work); - if (res) + if (res != 0) goto out; work->tgt = tgt; @@ -2168,7 +2168,7 @@ static ssize_t scst_rel_tgt_id_store(struct kobject *kobj, tgt = container_of(kobj, struct scst_tgt, tgt_kobj); res = strict_strtoul(buf, 0, &rel_tgt_id); - if (res) { + if (res != 0) { PRINT_ERROR("%s", "Wrong rel_tgt_id"); res = -EINVAL; goto out; @@ -2176,7 +2176,7 @@ static ssize_t scst_rel_tgt_id_store(struct kobject *kobj, res = scst_alloc_sysfs_work(scst_process_rel_tgt_id_store, false, &work); - if (res) + if (res != 0) goto out; work->tgt = tgt; @@ -2209,7 +2209,7 @@ int scst_tgt_sysfs_create(struct scst_tgt *tgt) res = kobject_init_and_add(&tgt->tgt_kobj, &tgt_ktype, &tgt->tgtt->tgtt_kobj, tgt->tgt_name); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add tgt %s to sysfs", tgt->tgt_name); goto out; } @@ -2218,7 +2218,7 @@ int scst_tgt_sysfs_create(struct scst_tgt *tgt) (tgt->tgtt->is_target_enabled != NULL)) { res = sysfs_create_file(&tgt->tgt_kobj, &tgt_enable_attr.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add attr %s to sysfs", tgt_enable_attr.attr.name); goto out_err; @@ -2238,7 +2238,7 @@ int scst_tgt_sysfs_create(struct scst_tgt *tgt) } res = sysfs_create_file(tgt->tgt_luns_kobj, &scst_luns_mgmt.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add attribute %s for tgt %s", scst_luns_mgmt.attr.name, tgt->tgt_name); goto out_err; @@ -2254,7 +2254,7 @@ int scst_tgt_sysfs_create(struct scst_tgt *tgt) res = sysfs_create_file(tgt->tgt_ini_grp_kobj, &scst_ini_group_mgmt.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add attribute %s for tgt %s", scst_ini_group_mgmt.attr.name, tgt->tgt_name); goto out_err; @@ -2262,7 +2262,7 @@ int scst_tgt_sysfs_create(struct scst_tgt *tgt) res = sysfs_create_file(&tgt->tgt_kobj, &scst_rel_tgt_id.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add attribute %s for tgt %s", scst_rel_tgt_id.attr.name, tgt->tgt_name); goto out_err; @@ -2270,7 +2270,7 @@ int scst_tgt_sysfs_create(struct scst_tgt *tgt) res = sysfs_create_file(&tgt->tgt_kobj, &scst_tgt_addr_method.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add attribute %s for tgt %s", scst_tgt_addr_method.attr.name, tgt->tgt_name); goto out_err; @@ -2278,14 +2278,14 @@ int scst_tgt_sysfs_create(struct scst_tgt *tgt) res = sysfs_create_file(&tgt->tgt_kobj, &scst_tgt_io_grouping_type.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add attribute %s for tgt %s", scst_tgt_io_grouping_type.attr.name, tgt->tgt_name); goto out_err; } res = sysfs_create_file(&tgt->tgt_kobj, &scst_tgt_cpu_mask.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add attribute %s for tgt %s", scst_tgt_cpu_mask.attr.name, tgt->tgt_name); goto out_err; @@ -2293,7 +2293,7 @@ int scst_tgt_sysfs_create(struct scst_tgt *tgt) if (tgt->tgtt->tgt_attrs) { res = sysfs_create_files(&tgt->tgt_kobj, tgt->tgtt->tgt_attrs); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add attributes for tgt %s", tgt->tgt_name); goto out_err; @@ -2411,11 +2411,11 @@ static int scst_process_dev_sysfs_threads_data_store( threads_num, threads_pool_type); res = scst_suspend_activity(true); - if (res) + if (res != 0) goto out; res = mutex_lock_interruptible(&scst_mutex); - if (res) + if (res != 0) goto out_resume; /* Check if our pointer is still alive */ @@ -2428,7 +2428,7 @@ static int scst_process_dev_sysfs_threads_data_store( dev->threads_pool_type = threads_pool_type; res = scst_create_dev_threads(dev); - if (res) + if (res != 0) goto out_unlock; if (oldtn != dev->threads_num) @@ -2512,7 +2512,7 @@ static ssize_t scst_dev_sysfs_threads_num_store(struct kobject *kobj, dev = container_of(kobj, struct scst_device, dev_kobj); res = strict_strtol(buf, 0, &newtn); - if (res) { + if (res != 0) { PRINT_ERROR("strict_strtol() for %s failed: %d ", buf, res); goto out; } @@ -2524,12 +2524,12 @@ static ssize_t scst_dev_sysfs_threads_num_store(struct kobject *kobj, res = scst_dev_sysfs_check_threads_data(dev, newtn, dev->threads_pool_type, &stop); - if (res || stop) + if ((res != 0) || stop) goto out; res = scst_alloc_sysfs_work(scst_dev_sysfs_threads_data_store_work_fn, false, &work); - if (res) + if (res != 0) goto out; work->dev = dev; @@ -2613,12 +2613,12 @@ static ssize_t scst_dev_sysfs_threads_pool_type_store(struct kobject *kobj, res = scst_dev_sysfs_check_threads_data(dev, dev->threads_num, newtpt, &stop); - if (res || stop) + if ((res != 0) || stop) goto out; res = scst_alloc_sysfs_work(scst_dev_sysfs_threads_data_store_work_fn, false, &work); - if (res) + if (res != 0) goto out; work->dev = dev; @@ -2669,7 +2669,7 @@ int scst_devt_dev_sysfs_create(struct scst_device *dev) res = sysfs_create_link(&dev->dev_kobj, &dev->handler->devt_kobj, "handler"); - if (res) { + if (res != 0) { PRINT_ERROR("Can't create handler link for dev %s", dev->virt_name); goto out; @@ -2677,7 +2677,7 @@ int scst_devt_dev_sysfs_create(struct scst_device *dev) res = sysfs_create_link(&dev->handler->devt_kobj, &dev->dev_kobj, dev->virt_name); - if (res) { + if (res != 0) { PRINT_ERROR("Can't create handler link for dev %s", dev->virt_name); goto out_err; @@ -2686,7 +2686,7 @@ int scst_devt_dev_sysfs_create(struct scst_device *dev) if (dev->handler->threads_num >= 0) { res = sysfs_create_file(&dev->dev_kobj, &dev_threads_num_attr.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add dev attr %s for dev %s", dev_threads_num_attr.attr.name, dev->virt_name); @@ -2694,7 +2694,7 @@ int scst_devt_dev_sysfs_create(struct scst_device *dev) } res = sysfs_create_file(&dev->dev_kobj, &dev_threads_pool_type_attr.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add dev attr %s for dev %s", dev_threads_pool_type_attr.attr.name, dev->virt_name); @@ -2705,7 +2705,7 @@ int scst_devt_dev_sysfs_create(struct scst_device *dev) if (dev->handler->dev_attrs) { res = sysfs_create_files(&dev->dev_kobj, dev->handler->dev_attrs); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add dev attributes for dev %s", dev->virt_name); goto out_err; @@ -2764,7 +2764,7 @@ int scst_dev_sysfs_create(struct scst_device *dev) res = kobject_init_and_add(&dev->dev_kobj, &scst_dev_ktype, scst_devices_kobj, dev->virt_name); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add device %s to sysfs", dev->virt_name); goto out; } @@ -2781,7 +2781,7 @@ int scst_dev_sysfs_create(struct scst_device *dev) if (dev->scsi_dev != NULL) { res = sysfs_create_link(&dev->dev_kobj, &dev->scsi_dev->sdev_dev.kobj, "scsi_device"); - if (res) { + if (res != 0) { PRINT_ERROR("Can't create scsi_device link for dev %s", dev->virt_name); goto out_del; @@ -2792,7 +2792,7 @@ int scst_dev_sysfs_create(struct scst_device *dev) if (dev->scsi_dev == NULL) { res = sysfs_create_file(&dev->dev_kobj, &dev_dump_prs_attr.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't create attr %s for dev %s", dev_dump_prs_attr.attr.name, dev->virt_name); goto out_del; @@ -3016,7 +3016,7 @@ int scst_tgt_dev_sysfs_create(struct scst_tgt_dev *tgt_dev) res = kobject_init_and_add(&tgt_dev->tgt_dev_kobj, &scst_tgt_dev_ktype, &tgt_dev->sess->sess_kobj, "lun%lld", (unsigned long long)tgt_dev->lun); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add tgt_dev %lld to sysfs", (unsigned long long)tgt_dev->lun); goto out; @@ -3227,7 +3227,7 @@ static int scst_sess_zero_latency(struct scst_sysfs_work_item *work) TRACE_ENTRY(); res = mutex_lock_interruptible(&scst_mutex); - if (res) + if (res != 0) goto out_put; PRINT_INFO("Zeroing latency statistics for initiator " @@ -3284,7 +3284,7 @@ static ssize_t scst_sess_latency_store(struct kobject *kobj, sess = container_of(kobj, struct scst_session, sess_kobj); res = scst_alloc_sysfs_work(scst_sess_zero_latency, false, &work); - if (res) + if (res != 0) goto out; work->sess = sess; @@ -3327,7 +3327,7 @@ static int scst_sysfs_sess_get_active_commands(struct scst_session *sess) TRACE_ENTRY(); res = mutex_lock_interruptible(&scst_mutex); - if (res) + if (res != 0) goto out_put; for (t = SESS_TGT_DEV_LIST_HASH_SIZE-1; t >= 0; t--) { @@ -3365,7 +3365,7 @@ static ssize_t scst_sess_sysfs_active_commands_show(struct kobject *kobj, res = scst_alloc_sysfs_work(scst_sysfs_sess_get_active_commands_work_fn, true, &work); - if (res) + if (res != 0) goto out; work->sess = sess; @@ -3445,7 +3445,7 @@ static int scst_create_sess_luns_link(struct scst_session *sess) res = sysfs_create_link(&sess->sess_kobj, sess->acg->luns_kobj, "luns"); - if (res) + if (res != 0) PRINT_ERROR("Can't create luns link for initiator %s", sess->initiator_name); @@ -3501,7 +3501,7 @@ restart: res = kobject_init_and_add(&sess->sess_kobj, &scst_session_ktype, sess->tgt->tgt_sess_kobj, name); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add session %s to sysfs", name); goto out_free; } @@ -3511,7 +3511,7 @@ restart: if (sess->tgt->tgtt->sess_attrs) { res = sysfs_create_files(&sess->sess_kobj, sess->tgt->tgtt->sess_attrs); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add attributes for session %s", name); goto out_free; } @@ -3659,7 +3659,7 @@ int scst_acg_dev_sysfs_create(struct scst_acg_dev *acg_dev, res = kobject_init_and_add(&acg_dev->acg_dev_kobj, &acg_dev_ktype, parent, "%llu", acg_dev->lun); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add acg_dev %p to sysfs", acg_dev); goto out; } @@ -3671,7 +3671,7 @@ int scst_acg_dev_sysfs_create(struct scst_acg_dev *acg_dev, res = sysfs_create_link(acg_dev->dev->dev_exp_kobj, &acg_dev->acg_dev_kobj, acg_dev->acg_dev_link_name); - if (res) { + if (res != 0) { PRINT_ERROR("Can't create acg %s LUN link", acg_dev->acg->acg_name); goto out_del; @@ -3679,7 +3679,7 @@ int scst_acg_dev_sysfs_create(struct scst_acg_dev *acg_dev, res = sysfs_create_link(&acg_dev->acg_dev_kobj, &acg_dev->dev->dev_kobj, "device"); - if (res) { + if (res != 0) { PRINT_ERROR("Can't create acg %s device link", acg_dev->acg->acg_name); goto out_del; @@ -3777,11 +3777,11 @@ static int scst_process_acg_ini_mgmt_store(char *buffer, } res = scst_suspend_activity(true); - if (res) + if (res != 0) goto out; res = mutex_lock_interruptible(&scst_mutex); - if (res) + if (res != 0) goto out_resume; /* Check if tgt and acg not already freed while we were coming here */ @@ -3807,7 +3807,7 @@ static int scst_process_acg_ini_mgmt_store(char *buffer, } res = scst_acg_add_acn(acg, name); - if (res) + if (res != 0) goto out_unlock; break; case SCST_ACG_ACTION_INI_DEL: @@ -3898,7 +3898,7 @@ static int scst_process_acg_ini_mgmt_store(char *buffer, scst_del_free_acn(acn, false); res = scst_acg_add_acn(acg_dest, name); - if (res) + if (res != 0) goto out_unlock; break; } @@ -4001,7 +4001,7 @@ static ssize_t scst_acg_io_grouping_type_store(struct kobject *kobj, acg = container_of(kobj, struct scst_acg, acg_kobj); res = __scst_acg_io_grouping_type_store(acg, buf, count); - if (res) + if (res != 0) goto out; res = count; @@ -4035,7 +4035,7 @@ static ssize_t scst_acg_cpu_mask_store(struct kobject *kobj, acg = container_of(kobj, struct scst_acg, acg_kobj); res = __scst_acg_cpu_mask_store(acg, buf, count); - if (res) + if (res != 0) goto out; res = count; @@ -4097,7 +4097,7 @@ int scst_acg_sysfs_create(struct scst_tgt *tgt, res = kobject_init_and_add(&acg->acg_kobj, &acg_ktype, tgt->tgt_ini_grp_kobj, acg->acg_name); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add acg '%s' to sysfs", acg->acg_name); goto out; } @@ -4111,7 +4111,7 @@ int scst_acg_sysfs_create(struct scst_tgt *tgt, } res = sysfs_create_file(acg->luns_kobj, &scst_acg_luns_mgmt.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add tgt attr %s for tgt %s", scst_acg_luns_mgmt.attr.name, tgt->tgt_name); goto out_del; @@ -4128,28 +4128,28 @@ int scst_acg_sysfs_create(struct scst_tgt *tgt, res = sysfs_create_file(acg->initiators_kobj, &scst_acg_ini_mgmt.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add tgt attr %s for tgt %s", scst_acg_ini_mgmt.attr.name, tgt->tgt_name); goto out_del; } res = sysfs_create_file(&acg->acg_kobj, &scst_acg_addr_method.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add tgt attr %s for tgt %s", scst_acg_addr_method.attr.name, tgt->tgt_name); goto out_del; } res = sysfs_create_file(&acg->acg_kobj, &scst_acg_io_grouping_type.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add tgt attr %s for tgt %s", scst_acg_io_grouping_type.attr.name, tgt->tgt_name); goto out_del; } res = sysfs_create_file(&acg->acg_kobj, &scst_acg_cpu_mask.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add tgt attr %s for tgt %s", scst_acg_cpu_mask.attr.name, tgt->tgt_name); goto out_del; @@ -4220,7 +4220,7 @@ int scst_acn_sysfs_create(struct scst_acn *acn) attr->store = NULL; res = sysfs_create_file(acg->initiators_kobj, &attr->attr); - if (res) { + if (res != 0) { PRINT_ERROR("Unable to create acn '%s' for group '%s'", acn->name, acg->acg_name); kfree(attr->attr.name); @@ -4299,7 +4299,7 @@ static ssize_t scst_devt_trace_level_store(struct kobject *kobj, devt = container_of(kobj, struct scst_dev_type, devt_kobj); res = mutex_lock_interruptible(&scst_log_mutex); - if (res) + if (res != 0) goto out; res = scst_write_trace(buf, count, devt->trace_flags, @@ -4475,7 +4475,7 @@ static ssize_t __scst_devt_mgmt_store(struct kobject *kobj, } res = scst_alloc_sysfs_work(sysfs_work_fn, false, &work); - if (res) + if (res != 0) goto out_free; work->buf = buffer; @@ -4563,7 +4563,7 @@ static int scst_process_devt_pass_through_mgmt_store(char *buffer, TRACE_DBG("Dev %ld:%ld:%ld:%ld", host, channel, id, lun); res = mutex_lock_interruptible(&scst_mutex); - if (res) + if (res != 0) goto out; /* Check if devt not be already freed while we were coming here */ @@ -4663,7 +4663,7 @@ int scst_devt_sysfs_create(struct scst_dev_type *devt) res = kobject_init_and_add(&devt->devt_kobj, &scst_devt_ktype, parent, devt->name); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add devt %s to sysfs", devt->name); goto out; } @@ -4675,7 +4675,7 @@ int scst_devt_sysfs_create(struct scst_dev_type *devt) res = sysfs_create_file(&devt->devt_kobj, &scst_devt_pass_through_mgmt.attr); } - if (res) { + if (res != 0) { PRINT_ERROR("Can't add mgmt attr for dev handler %s", devt->name); goto out_err; @@ -4683,7 +4683,7 @@ int scst_devt_sysfs_create(struct scst_dev_type *devt) if (devt->devt_attrs) { res = sysfs_create_files(&devt->devt_kobj, devt->devt_attrs); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add attributes for dev handler %s", devt->name); goto out_err; @@ -4694,7 +4694,7 @@ int scst_devt_sysfs_create(struct scst_dev_type *devt) if (devt->trace_flags != NULL) { res = sysfs_create_file(&devt->devt_kobj, &devt_trace_attr.attr); - if (res) { + if (res != 0) { PRINT_ERROR("Can't add devt trace_flag for dev " "handler %s", devt->name); goto out_err; @@ -4766,7 +4766,7 @@ static int scst_process_threads_store(int newtn) TRACE_DBG("newtn %d", newtn); res = mutex_lock_interruptible(&scst_mutex); - if (res) + if (res != 0) goto out; oldtn = scst_main_cmd_threads.nr_threads; @@ -4776,7 +4776,7 @@ static int scst_process_threads_store(int newtn) scst_del_threads(&scst_main_cmd_threads, -delta); else { res = scst_add_threads(&scst_main_cmd_threads, NULL, NULL, delta); - if (res) + if (res != 0) goto out_up; } @@ -4805,7 +4805,7 @@ static ssize_t scst_threads_store(struct kobject *kobj, TRACE_ENTRY(); res = strict_strtol(buf, 0, &newtn); - if (res) { + if (res != 0) { PRINT_ERROR("strict_strtol() for %s failed: %d ", buf, res); goto out; } @@ -4816,7 +4816,7 @@ static ssize_t scst_threads_store(struct kobject *kobj, } res = scst_alloc_sysfs_work(scst_threads_store_work_fn, false, &work); - if (res) + if (res != 0) goto out; work->new_threads_num = newtn; @@ -4857,7 +4857,7 @@ static ssize_t scst_setup_id_store(struct kobject *kobj, TRACE_ENTRY(); res = strict_strtoul(buf, 0, &val); - if (res) { + if (res != 0) { PRINT_ERROR("strict_strtoul() for %s failed: %d ", buf, res); goto out; } @@ -4893,7 +4893,7 @@ static ssize_t scst_main_trace_level_store(struct kobject *kobj, TRACE_ENTRY(); res = mutex_lock_interruptible(&scst_log_mutex); - if (res) + if (res != 0) goto out; res = scst_write_trace(buf, count, &trace_flag, @@ -5248,7 +5248,7 @@ int __init scst_sysfs_init(void) res = kobject_init_and_add(&scst_sysfs_root_kobj, &scst_sysfs_root_ktype, kernel_kobj, "%s", "scst_tgt"); - if (res) + if (res != 0) goto sysfs_root_add_error; scst_targets_kobj = kobject_create_and_add("targets", @@ -5262,7 +5262,7 @@ int __init scst_sysfs_init(void) goto devices_kobj_error; res = scst_add_sgv_kobj(&scst_sysfs_root_kobj, "sgv"); - if (res) + if (res != 0) goto sgv_kobj_error; scst_handlers_kobj = kobject_create_and_add("handlers",