From: <vl...@us...> - 2008-06-12 11:22:23
|
Revision: 404 http://scst.svn.sourceforge.net/scst/?rev=404&view=rev Author: vlnb Date: 2008-06-12 04:22:15 -0700 (Thu, 12 Jun 2008) Log Message: ----------- Patch from Bart Van Assche <bar...@gm...>: 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 <bar...@gm...> Modified Paths: -------------- trunk/iscsi-scst/kernel/config.c trunk/iscsi-scst/kernel/event.c trunk/iscsi-scst/kernel/iscsi.c trunk/iscsi-scst/kernel/param.c trunk/iscsi-scst/kernel/session.c trunk/iscsi-scst/kernel/target.c trunk/scst/include/scst_debug.h trunk/scst/src/dev_handlers/scst_user.c trunk/scst/src/scst_proc.c trunk/scst/src/scst_targ.c Modified: trunk/iscsi-scst/kernel/config.c =================================================================== --- trunk/iscsi-scst/kernel/config.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/iscsi-scst/kernel/config.c 2008-06-12 11:22:15 UTC (rev 404) @@ -235,7 +235,8 @@ 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); @@ -260,10 +261,12 @@ 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); @@ -276,10 +279,12 @@ 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); @@ -292,7 +297,8 @@ 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); @@ -314,7 +320,8 @@ 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'; @@ -329,7 +336,8 @@ 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); @@ -341,10 +349,12 @@ 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) @@ -360,10 +370,12 @@ 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; @@ -431,10 +443,12 @@ 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) { Modified: trunk/iscsi-scst/kernel/event.c =================================================================== --- trunk/iscsi-scst/kernel/event.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/iscsi-scst/kernel/event.c 2008-06-12 11:22:15 UTC (rev 404) @@ -56,7 +56,8 @@ 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); @@ -91,7 +92,8 @@ 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); Modified: trunk/iscsi-scst/kernel/iscsi.c =================================================================== --- trunk/iscsi-scst/kernel/iscsi.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/iscsi-scst/kernel/iscsi.c 2008-06-12 11:22:15 UTC (rev 404) @@ -932,7 +932,8 @@ iscsi_extracheck_is_rd_thread(conn); - if (!(size = cmnd->pdu.datasize)) + size = cmnd->pdu.datasize; + if (!size) return; if (sg == NULL) { @@ -1210,13 +1211,17 @@ 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)) { @@ -1615,7 +1620,8 @@ 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); @@ -2909,13 +2915,15 @@ "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); @@ -2930,7 +2938,8 @@ 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); Modified: trunk/iscsi-scst/kernel/param.c =================================================================== --- trunk/iscsi-scst/kernel/param.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/iscsi-scst/kernel/param.c 2008-06-12 11:22:15 UTC (rev 404) @@ -213,7 +213,8 @@ 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; Modified: trunk/iscsi-scst/kernel/session.c =================================================================== --- trunk/iscsi-scst/kernel/session.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/iscsi-scst/kernel/session.c 2008-06-12 11:22:15 UTC (rev 404) @@ -35,7 +35,8 @@ 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; Modified: trunk/iscsi-scst/kernel/target.c =================================================================== --- trunk/iscsi-scst/kernel/target.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/iscsi-scst/kernel/target.c 2008-06-12 11:22:15 UTC (rev 404) @@ -87,7 +87,8 @@ 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; } @@ -97,7 +98,8 @@ goto out; } - if (!(target = kzalloc(sizeof(*target), GFP_KERNEL))) { + target = kzalloc(sizeof(*target), GFP_KERNEL); + if (!target) { err = -ENOMEM; goto out_put; } @@ -161,7 +163,8 @@ tid = next_target_id; } - if (!(err = iscsi_target_create(info, tid))) + err = iscsi_target_create(info, tid); + if (!err) nr_targets++; out: return err; @@ -184,7 +187,8 @@ 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; } @@ -277,7 +281,8 @@ 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) { Modified: trunk/scst/include/scst_debug.h =================================================================== --- trunk/scst/include/scst_debug.h 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/scst/include/scst_debug.h 2008-06-12 11:22:15 UTC (rev 404) @@ -244,8 +244,7 @@ #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); \ Modified: trunk/scst/src/dev_handlers/scst_user.c =================================================================== --- trunk/scst/src/dev_handlers/scst_user.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/scst/src/dev_handlers/scst_user.c 2008-06-12 11:22:15 UTC (rev 404) @@ -111,7 +111,7 @@ 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. */ @@ -983,15 +983,15 @@ 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, Modified: trunk/scst/src/scst_proc.c =================================================================== --- trunk/scst/src/scst_proc.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/scst/src/scst_proc.c 2008-06-12 11:22:15 UTC (rev 404) @@ -1171,7 +1171,8 @@ goto out; } - if (!(buffer = (char *)__get_free_page(GFP_KERNEL))) { + buffer = (char *)__get_free_page(GFP_KERNEL); + if (!buffer) { res = -ENOMEM; goto out; } Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-05-31 12:05:02 UTC (rev 403) +++ trunk/scst/src/scst_targ.c 2008-06-12 11:22:15 UTC (rev 404) @@ -541,7 +541,7 @@ } if (unlikely(cmd->bufflen != cmd->expected_transfer_len)) { static int repd; - + if (repd < 100) { /* * Intentionally unlocked. Few messages more This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |