From 98285d10fdf9f79d68aaa0a6661ae27d9235ba7f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 2 Nov 2020 02:06:04 +0000 Subject: [PATCH 1/2] Various fixes for issues detected by checkpatch - Return EOPNOTSUPP instead of ENOTSUPP to user space. - Do not terminate macro definitions with a trailing semicolon. - Do not initialize static variables to zero. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9176 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 4 ++-- scst/src/dev_handlers/scst_vdisk.c | 2 +- scst/src/scst_pres.c | 2 +- scst/src/scst_sysfs.c | 2 +- srpt/src/ib_srpt.c | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 3273b9420..5d06aa0f4 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -1135,7 +1135,7 @@ static inline int pcie_capability_read_word(struct pci_dev *dev, int pos, { WARN_ON_ONCE(true); *val = 0; - return -ENOTSUPP; + return -EOPNOTSUPP; } static inline int pcie_capability_read_dword(struct pci_dev *dev, int pos, @@ -1143,7 +1143,7 @@ static inline int pcie_capability_read_dword(struct pci_dev *dev, int pos, { WARN_ON_ONCE(true); *val = 0; - return -ENOTSUPP; + return -EOPNOTSUPP; } #endif diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index dc4c2677a..22c9bda8d 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -6797,7 +6797,7 @@ static int vdisk_create_bioset(struct scst_vdisk_dev *virt_dev) /* The same, pool size doesn't really matter */ res = bioset_integrity_create(virt_dev->vdisk_bioset, 2); #else - res = -ENOTSUPP; + res = -EOPNOTSUPP; #endif if (res != 0) { PRINT_ERROR("Failed to create integrity bioset " diff --git a/scst/src/scst_pres.c b/scst/src/scst_pres.c index d4517bcf7..12c44cfc3 100644 --- a/scst/src/scst_pres.c +++ b/scst/src/scst_pres.c @@ -1167,7 +1167,7 @@ int scst_pr_set_cluster_mode(struct scst_device *dev, bool cluster_mode, out: #else - res = cluster_mode ? -ENOTSUPP : 0; + res = cluster_mode ? -EOPNOTSUPP : 0; #endif return res; diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index 24a596aca..0205fa7f4 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -4880,7 +4880,7 @@ static struct kobj_type scst_session_ktype = { scst_sess_latency_store); \ static struct kobj_attribute sess_lat_attr_b##size = \ __ATTR(b##size, S_IRUGO | S_IWUSR, scst_sess_latency_show, \ - scst_sess_latency_store); + scst_sess_latency_store) SCST_LAT_ATTR(512); SCST_LAT_ATTR(1024); SCST_LAT_ATTR(2048); diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 0c528e54c..763c4804e 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -164,7 +164,7 @@ module_param_call(srpt_service_guid, NULL, srpt_get_u64_x, &srpt_service_guid, MODULE_PARM_DESC(srpt_service_guid, "Using this value for ioc_guid, id_ext, and cm_listen_id instead of using the node_guid of the first HCA."); -static unsigned int max_sge_delta = 0; +static unsigned int max_sge_delta; module_param(max_sge_delta, uint, 0444); MODULE_PARM_DESC(max_sge_delta, "Number to subtract from max_sge (obsolete)."); @@ -4434,7 +4434,7 @@ static int srpt_add_one(struct ib_device *device) #endif sdev->srq = use_srq ? ib_create_srq(sdev->pd, &srq_attr) : - ERR_PTR(-ENOTSUPP); + ERR_PTR(-EOPNOTSUPP); if (IS_ERR(sdev->srq)) { if (use_srq) pr_debug("ib_create_srq() failed: %ld\n", From 0ab62f9527065b5f6233619e78ca9cc3351313f9 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 2 Nov 2020 02:07:17 +0000 Subject: [PATCH 2/2] Fix more issues detected by checkpatch Leave a blank line between declarations and definitions. Remove duplicate words from comments. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9177 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 2 +- scst/include/scst_const.h | 4 ++-- scst/src/scst_lib.c | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 5d06aa0f4..b0fbdb55a 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -1556,7 +1556,7 @@ typedef void (*rcu_callback_t)(struct rcu_head *); (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 7 || \ RHEL_MAJOR -0 == 7 && RHEL_MINOR -0 < 7) /* - * See also commit 546a9d8519ed ("rcu: Export debug_init_rcu_head() and and + * See also commit 546a9d8519ed ("rcu: Export debug_init_rcu_head() and * debug_init_rcu_head()") # v3.16. */ static inline void init_rcu_head(struct rcu_head *head) { } diff --git a/scst/include/scst_const.h b/scst/include/scst_const.h index d8c9b1042..0ca327d05 100644 --- a/scst/include/scst_const.h +++ b/scst/include/scst_const.h @@ -742,8 +742,8 @@ enum scst_tg_sup { /* * Error code returned by target attribute sysfs methods if invoked after - * scst_register_target() finished but before before scst_tgt_set_tgt_priv() - * has been invoked. + * scst_register_target() finished but before scst_tgt_set_tgt_priv() has been + * invoked. */ enum { E_TGT_PRIV_NOT_YET_SET = EBUSY diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 29f75016b..2f969b669 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -6001,6 +6001,7 @@ ssize_t kernel_write(struct file *file, const void *buf, size_t count, { mm_segment_t old_fs = get_fs(); ssize_t result; + set_fs(KERNEL_DS); { #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) @@ -8189,7 +8190,7 @@ static struct request *blk_make_request(struct request_queue *q, return ERR_PTR(ret); } /* - * See also commit commit 0abc2a10389f ("block: fix + * See also commit 0abc2a10389f ("block: fix * blk_rq_append_bio"). That commit has been backported to * kernel v4.14.11 as 88da02868f77. */