The patch below fixes all remaining checkpatch errors:
- ERROR: do not use assignment in if condition
- ERROR: that open brace { should be on the previous line
- ERROR: trailing whitespace
- ERROR: use tabs not spaces
The last three had already been fixed before, but some occurences were
reintroduced in r403. It would be great if new modifications could be checked
for checkpatch errors before being committed.
This patch has been tested as follows:
- Reread the patch below carefully.
- Verified that make -s clean && make -s iscsi scst && make -s -C srpt
still works and does not trigger any compiler warnings.
- Verified that checkpatch does no longer report any errors.
- Checked that the patch generated by generate-kernel-patch still applies
cleanly to the 2.6.25.4 kernel, and that the patched kernel tree still
compiles, installs and boots fine, and that the iscsi-scst, ib_srpt,
scst_disk and scst_vdisk modules still load.
- Tested that iSCSI login/logout still works from a remote system, and that
iSCSI I/O still works.
Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com>
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@404
d57e44dd-8a1f-0410-8b47-
8ef2f437770f
struct conn_info info;
struct iscsi_conn *conn;
- if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0)
+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
+ if (err < 0)
return err;
session = session_lookup(target, info.sid);
struct iscsi_session *session;
struct conn_info info;
- if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0)
+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
+ if (err < 0)
return err;
- if (!(session = session_lookup(target, info.sid)))
+ session = session_lookup(target, info.sid);
+ if (!session)
return -ENOENT;
return conn_add(session, &info);
struct iscsi_session *session;
struct conn_info info;
- if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0)
+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
+ if (err < 0)
return err;
- if (!(session = session_lookup(target, info.sid)))
+ session = session_lookup(target, info.sid);
+ if (!session)
return -ENOENT;
return conn_del(session, &info);
struct iscsi_session *session;
struct session_info info;
- if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0)
+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
+ if (err < 0)
return err;
session = session_lookup(target, info.sid);
int err;
struct session_info info;
- if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0)
+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
+ if (err < 0)
return err;
info.initiator_name[ISCSI_NAME_LEN-1] = '\0';
int err;
struct session_info info;
- if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0)
+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
+ if (err < 0)
return err;
return session_del(target, info.sid);
int err;
struct iscsi_param_info info;
- if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0)
+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
+ if (err < 0)
goto out;
- if ((err = iscsi_param_set(target, &info, set)) < 0)
+ err = iscsi_param_set(target, &info, set);
+ if (err < 0)
goto out;
if (!set)
int err;
struct target_info info;
- if ((err = copy_from_user(&info, (void *) ptr, sizeof(info))) < 0)
+ err = copy_from_user(&info, (void *) ptr, sizeof(info));
+ if (err < 0)
return err;
- if (!(err = target_add(&info)))
+ err = target_add(&info);
+ if (!err)
err = copy_to_user((void *) ptr, &info, sizeof(info));
return err;
goto out;
}
- if ((err = get_user(id, (u32 *) arg)) != 0)
+ err = get_user(id, (u32 *) arg);
+ if (err != 0)
goto out;
- if ((err = mutex_lock_interruptible(&target_mgmt_mutex)) < 0)
+ err = mutex_lock_interruptible(&target_mgmt_mutex);
+ if (err < 0)
goto out;
if (cmd == DEL_TARGET) {
rlen = NLMSG_ALIGN(nlh->nlmsg_len);
if (rlen > skb->len)
rlen = skb->len;
- if ((err = event_recv_msg(skb, nlh)))
+ err = event_recv_msg(skb, nlh);
+ if (err)
netlink_ack(skb, nlh, -err);
else if (nlh->nlmsg_flags & NLM_F_ACK)
netlink_ack(skb, nlh, 0);
struct nlmsghdr *nlh;
static u32 seq;
- if (!(skb = alloc_skb(NLMSG_SPACE(len), gfp_mask)))
+ skb = alloc_skb(NLMSG_SPACE(len), gfp_mask);
+ if (!skb)
return -ENOMEM;
nlh = __nlmsg_put(skb, iscsid_pid, seq++, NLMSG_DONE, len - sizeof(*nlh), 0);
iscsi_extracheck_is_rd_thread(conn);
- if (!(size = cmnd->pdu.datasize))
+ size = cmnd->pdu.datasize;
+ if (!size)
return;
if (sg == NULL) {
spin_unlock(&conn->session->sn_lock);
if (unlikely(err))
goto out;
- } else if (unlikely((err = cmnd_insert_hash(cmnd)) < 0)) {
- PRINT_ERROR("Can't insert in hash: ignore this request %x",
- cmnd_itt(cmnd));
- goto out;
+ } else {
+ err = cmnd_insert_hash(cmnd);
+ if (unlikely(err < 0)) {
+ PRINT_ERROR("Can't insert in hash: ignore this request %x",
+ cmnd_itt(cmnd));
+ goto out;
+ }
}
- if ((size = cmnd->pdu.datasize)) {
+ size = cmnd->pdu.datasize;
+ if (size) {
size = (size + 3) & -4;
conn->read_msg.msg_iov = conn->read_iov;
if (cmnd->pdu.bhs.itt != cpu_to_be32(ISCSI_RESERVED_TAG)) {
goto out;
}
- if ((cmnd = cmnd_find_hash_get(session, req_hdr->rtt, ISCSI_RESERVED_TAG))) {
+ cmnd = cmnd_find_hash_get(session, req_hdr->rtt, ISCSI_RESERVED_TAG);
+ if (cmnd) {
struct iscsi_conn *conn = cmnd->conn;
struct iscsi_scsi_cmd_hdr *hdr = cmnd_hdr(cmnd);
"degraded mode. Refer README file for details");
#endif
- if ((ctr_major = register_chrdev(0, ctr_name, &ctr_fops)) < 0) {
+ ctr_major = register_chrdev(0, ctr_name, &ctr_fops);
+ if (ctr_major < 0) {
PRINT_ERROR("failed to register the control device %d", ctr_major);
err = ctr_major;
goto out_callb;
}
- if ((err = event_init()) < 0)
+ err = event_init();
+ if (err < 0)
goto out_reg;
iscsi_cmnd_cache = KMEM_CACHE(iscsi_cmnd, SCST_SLAB_FLAGS);
iscsi_template_registered = 1;
- if ((err = iscsi_procfs_init()) < 0)
+ err = iscsi_procfs_init();
+ if (err < 0)
goto out_reg_tmpl;
num = max(num_online_cpus(), 2);
sess_param_check(info);
if (info->sid) {
- if (!(session = session_lookup(target, info->sid)))
+ session = session_lookup(target, info->sid);
+ if (!session)
goto out;
if (set && !list_empty(&session->conn_list)) {
err = -EBUSY;
struct iscsi_session *session;
char *name = NULL;
- if (!(session = kzalloc(sizeof(*session), GFP_KERNEL)))
+ session = kzalloc(sizeof(*session), GFP_KERNEL);
+ if (!session)
return -ENOMEM;
session->target = target;
TRACE_MGMT_DBG("Creating target tid %u, name %s", tid, name);
- if (!(len = strlen(name))) {
+ len = strlen(name);
+ if (!len) {
PRINT_ERROR("The length of the target name is zero %u", tid);
goto out;
}
goto out;
}
- if (!(target = kzalloc(sizeof(*target), GFP_KERNEL))) {
+ target = kzalloc(sizeof(*target), GFP_KERNEL);
+ if (!target) {
err = -ENOMEM;
goto out_put;
}
tid = next_target_id;
}
- if (!(err = iscsi_target_create(info, tid)))
+ err = iscsi_target_create(info, tid);
+ if (!err)
nr_targets++;
out:
return err;
struct iscsi_target *target;
int err;
- if (!(target = target_lookup_by_id(id))) {
+ target = target_lookup_by_id(id);
+ if (!target) {
err = -ENOENT;
goto out;
}
int err;
struct iscsi_target *target;
- if ((err = mutex_lock_interruptible(&target_mgmt_mutex)) < 0)
+ err = mutex_lock_interruptible(&target_mgmt_mutex);
+ if (err < 0)
return err;
list_for_each_entry(target, &target_list, target_list_entry) {
#define PRINT_WARNING(format, args...) \
do { \
- if (strcmp(INFO_FLAG, LOG_FLAG)) \
- { \
+ if (strcmp(INFO_FLAG, LOG_FLAG)) { \
PRINT_LOG_FLAG(LOG_FLAG, "***WARNING*** " format, args); \
} \
PRINT_LOG_FLAG(INFO_FLAG, "***WARNING*** " format, args); \
struct page **data_pages;
struct sgv_pool_obj *sgv;
- /*
+ /*
* Special flags, which can be accessed asynchronously (hence "long").
* Protected by cmd_lists.cmd_list_lock.
*/
if ((ucmd->state == UCMD_STATE_PARSING) ||
(ucmd->state == UCMD_STATE_BUF_ALLOCING)) {
- /*
- * If we don't put such commands in the queue head, then under
- * high load we might delay threads, waiting for memory
- * allocations, for too long and start loosing NOPs, which
- * would lead to consider us by remote initiators as
- * unresponsive and stuck => broken connections, etc. If none
- * of our commands completed in NOP timeout to allow the head
- * commands to go, then we are really overloaded and/or stuck.
- */
+ /*
+ * If we don't put such commands in the queue head, then under
+ * high load we might delay threads, waiting for memory
+ * allocations, for too long and start loosing NOPs, which
+ * would lead to consider us by remote initiators as
+ * unresponsive and stuck => broken connections, etc. If none
+ * of our commands completed in NOP timeout to allow the head
+ * commands to go, then we are really overloaded and/or stuck.
+ */
TRACE_DBG("Adding ucmd %p (state %d) to head of ready "
"cmd list", ucmd, ucmd->state);
list_add(&ucmd->ready_cmd_list_entry,
goto out;
}
- if (!(buffer = (char *)__get_free_page(GFP_KERNEL))) {
+ buffer = (char *)__get_free_page(GFP_KERNEL);
+ if (!buffer) {
res = -ENOMEM;
goto out;
}
}
if (unlikely(cmd->bufflen != cmd->expected_transfer_len)) {
static int repd;
-
+
if (repd < 100) {
/*
* Intentionally unlocked. Few messages more