[PATCH -next 2/2] ftrace: Add kernel-doc comments for unregister_ftrace_direct() function

2024-06-07 Thread Yang Li
Added kernel-doc comments for the unregister_ftrace_direct() function to
improve code documentation and readability.

Reported-by: Abaci Robot 
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9300
Signed-off-by: Yang Li 
---
 kernel/trace/ftrace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 4aeb1183ea9f..3b0dbd55cc05 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5988,6 +5988,8 @@ EXPORT_SYMBOL_GPL(register_ftrace_direct);
  * unregister_ftrace_direct - Remove calls to custom trampoline
  * previously registered by register_ftrace_direct for @ops object.
  * @ops: The address of the struct ftrace_ops object
+ * @addr: The address of the direct call to remove
+ * @free_filters: Boolean indicating whether to free the filters
  *
  * This is used to remove a direct calls to @addr from the nop locations
  * of the functions registered in @ops (with by ftrace_set_filter_ip
-- 
2.20.1.7.g153144c




[PATCH -next 1/2] function_graph: Add kernel-doc comments for ftrace_graph_ret_addr() function

2024-06-07 Thread Yang Li
Added kernel-doc comments for the ftrace_graph_ret_addr() function to
improve code documentation and readability.

Reported-by: Abaci Robot 
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9299
Signed-off-by: Yang Li 
---
 kernel/trace/fgraph.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
index a13551a023aa..4ad33e4cb8da 100644
--- a/kernel/trace/fgraph.c
+++ b/kernel/trace/fgraph.c
@@ -872,6 +872,12 @@ ftrace_graph_get_ret_stack(struct task_struct *task, int 
idx)
 /**
  * ftrace_graph_ret_addr - convert a potentially modified stack return address
  *to its original value
+ * @task: pointer to the task_struct of the task being examined
+ * @idx: pointer to a state variable, should be initialized to zero
+ *  before the first call
+ * @ret: the current return address found on the stack
+ * @retp: pointer to the return address on the stack, ignored if
+ *   HAVE_FUNCTION_GRAPH_RET_ADDR_PTR is not defined
  *
  * This function can be called by stack unwinding code to convert a found stack
  * return address ('ret') to its original value, in case the function graph
-- 
2.20.1.7.g153144c




[PATCH] rv: Update rv_en(dis)able_monitor doc to match kernel-doc

2024-05-19 Thread Yang Li
The patch updates the function documentation comment for
rv_en(dis)able_monitor to adhere to the kernel-doc specification.

Signed-off-by: Yang Li 
---
 kernel/trace/rv/rv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c
index 2f68e93fff0b..df0745a42a3f 100644
--- a/kernel/trace/rv/rv.c
+++ b/kernel/trace/rv/rv.c
@@ -245,6 +245,7 @@ static int __rv_disable_monitor(struct rv_monitor_def 
*mdef, bool sync)
 
 /**
  * rv_disable_monitor - disable a given runtime monitor
+ * @mdef: Pointer to the monitor definition structure.
  *
  * Returns 0 on success.
  */
@@ -256,6 +257,7 @@ int rv_disable_monitor(struct rv_monitor_def *mdef)
 
 /**
  * rv_enable_monitor - enable a given runtime monitor
+ * @mdef: Pointer to the monitor definition structure.
  *
  * Returns 0 on success, error otherwise.
  */
-- 
2.20.1.7.g153144c




[PATCH -next] rv: Update rv_en(dis)able_monitor doc to match kernel-doc

2024-05-17 Thread Yang Li
The patch updates the function documentation comment for
rv_en(dis)able_monitor to adhere to the kernel-doc specification.

Signed-off-by: Yang Li 
---
 kernel/trace/rv/rv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c
index 2f68e93fff0b..df0745a42a3f 100644
--- a/kernel/trace/rv/rv.c
+++ b/kernel/trace/rv/rv.c
@@ -245,6 +245,7 @@ static int __rv_disable_monitor(struct rv_monitor_def 
*mdef, bool sync)
 
 /**
  * rv_disable_monitor - disable a given runtime monitor
+ * @mdef: Pointer to the monitor definition structure.
  *
  * Returns 0 on success.
  */
@@ -256,6 +257,7 @@ int rv_disable_monitor(struct rv_monitor_def *mdef)
 
 /**
  * rv_enable_monitor - enable a given runtime monitor
+ * @mdef: Pointer to the monitor definition structure.
  *
  * Returns 0 on success, error otherwise.
  */
-- 
2.20.1.7.g153144c




[PATCH -next] fs: Fix kernel-doc comments to functions

2024-03-22 Thread Yang Li
This commit fix kernel-doc style comments with complete parameter
descriptions for the lookup_file(),lookup_dir_entry() and
lookup_file_dentry().

Signed-off-by: Yang Li 
---
 fs/tracefs/event_inode.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index dc067eeb6387..894c6ca1e500 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -336,6 +336,7 @@ static void update_inode_attr(struct dentry *dentry, struct 
inode *inode,
 
 /**
  * lookup_file - look up a file in the tracefs filesystem
+ * @parent_ei: Pointer to the eventfs_inode that represents parent of the file
  * @dentry: the dentry to look up
  * @mode: the permission that the file should have.
  * @attr: saved attributes changed by user
@@ -389,6 +390,7 @@ static struct dentry *lookup_file(struct eventfs_inode 
*parent_ei,
 /**
  * lookup_dir_entry - look up a dir in the tracefs filesystem
  * @dentry: the directory to look up
+ * @pei: Pointer to the parent eventfs_inode if available
  * @ei: the eventfs_inode that represents the directory to create
  *
  * This function will look up a dentry for a directory represented by
@@ -478,16 +480,20 @@ void eventfs_d_release(struct dentry *dentry)
 
 /**
  * lookup_file_dentry - create a dentry for a file of an eventfs_inode
+ * @dentry: The parent dentry under which the new file's dentry will be created
  * @ei: the eventfs_inode that the file will be created under
  * @idx: the index into the entry_attrs[] of the @ei
- * @parent: The parent dentry of the created file.
- * @name: The name of the file to create
  * @mode: The mode of the file.
  * @data: The data to use to set the inode of the file with on open()
  * @fops: The fops of the file to be created.
  *
- * Create a dentry for a file of an eventfs_inode @ei and place it into the
- * address located at @e_dentry.
+ * This function creates a dentry for a file associated with an
+ * eventfs_inode @ei. It uses the entry attributes specified by @idx,
+ * if available. The file will have the specified @mode and its inode will be
+ * set up with @data upon open. The file operations will be set to @fops.
+ *
+ * Return: Returns a pointer to the newly created file's dentry or an error
+ * pointer.
  */
 static struct dentry *
 lookup_file_dentry(struct dentry *dentry,
-- 
2.20.1.7.g153144c




[PATCH -next] libnvdimm: Fix some kernel-doc comments

2023-02-19 Thread Yang Li
Make the description of @nvdimm to @ndd in function
nvdimm_init_nsarea() and nvdimm_allocated_dpa () to silence the warnings:
drivers/nvdimm/dimm_devs.c:59: warning: Function parameter or member 'ndd' not 
described in 'nvdimm_init_nsarea'
drivers/nvdimm/dimm_devs.c:59: warning: Excess function parameter 'nvdimm' 
description in 'nvdimm_init_nsarea'
drivers/nvdimm/dimm_devs.c:844: warning: Function parameter or member 'ndd' not 
described in 'nvdimm_allocated_dpa'
drivers/nvdimm/dimm_devs.c:844: warning: Excess function parameter 'nvdimm' 
description in 'nvdimm_allocated_dpa

Reported-by: Abaci Robot 
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4118
Signed-off-by: Yang Li 
---
 drivers/nvdimm/dimm_devs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
index 957f7c3d17ba..fc152e6016ca 100644
--- a/drivers/nvdimm/dimm_devs.c
+++ b/drivers/nvdimm/dimm_devs.c
@@ -53,7 +53,7 @@ static int validate_dimm(struct nvdimm_drvdata *ndd)
 
 /**
  * nvdimm_init_nsarea - determine the geometry of a dimm's namespace area
- * @nvdimm: dimm to initialize
+ * @ndd: dimm to initialize
  */
 int nvdimm_init_nsarea(struct nvdimm_drvdata *ndd)
 {
@@ -836,7 +836,7 @@ struct resource *nvdimm_allocate_dpa(struct nvdimm_drvdata 
*ndd,
 
 /**
  * nvdimm_allocated_dpa - sum up the dpa currently allocated to this label_id
- * @nvdimm: container of dpa-resource-root + labels
+ * @ndd: container of dpa-resource-root + labels
  * @label_id: dpa resource name of the form pmem-
  */
 resource_size_t nvdimm_allocated_dpa(struct nvdimm_drvdata *ndd,
-- 
2.20.1.7.g153144c




[PATCH -next] nvdimm: make security_show() static

2022-12-05 Thread Yang Li
This symbol is not used outside of dimm_devs.c, so marks it
static to silence missing prototype warning

drivers/nvdimm/dimm_devs.c:352:9: warning: no previous prototype for function 
'security_show'

Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3362
Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/nvdimm/dimm_devs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
index 17b56171c2c2..71fef964c5bc 100644
--- a/drivers/nvdimm/dimm_devs.c
+++ b/drivers/nvdimm/dimm_devs.c
@@ -349,7 +349,7 @@ static ssize_t available_slots_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(available_slots);
 
-ssize_t security_show(struct device *dev,
+static ssize_t security_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
struct nvdimm *nvdimm = to_nvdimm(dev);
-- 
2.20.1.7.g153144c




[PATCH -next] nvdimm: Fix some kernel-doc comments

2022-12-05 Thread Yang Li
Make the description of @nvdimm to @ndd in nvdimm_init_nsarea()
and nvdimm_allocated_dpa() to clear the below warnings:

drivers/nvdimm/dimm_devs.c:59: warning: Function parameter or member 'ndd' not 
described in 'nvdimm_init_nsarea'
drivers/nvdimm/dimm_devs.c:59: warning: Excess function parameter 'nvdimm' 
description in 'nvdimm_init_nsarea'
drivers/nvdimm/dimm_devs.c:841: warning: Function parameter or member 'ndd' not 
described in 'nvdimm_allocated_dpa'
drivers/nvdimm/dimm_devs.c:841: warning: Excess function parameter 'nvdimm' 
description in 'nvdimm_allocated_dpa'

Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3361
Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/nvdimm/dimm_devs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
index 1fc081dcf631..17b56171c2c2 100644
--- a/drivers/nvdimm/dimm_devs.c
+++ b/drivers/nvdimm/dimm_devs.c
@@ -53,7 +53,7 @@ static int validate_dimm(struct nvdimm_drvdata *ndd)
 
 /**
  * nvdimm_init_nsarea - determine the geometry of a dimm's namespace area
- * @nvdimm: dimm to initialize
+ * @ndd: dimm to initialize
  */
 int nvdimm_init_nsarea(struct nvdimm_drvdata *ndd)
 {
@@ -833,7 +833,7 @@ struct resource *nvdimm_allocate_dpa(struct nvdimm_drvdata 
*ndd,
 
 /**
  * nvdimm_allocated_dpa - sum up the dpa currently allocated to this label_id
- * @nvdimm: container of dpa-resource-root + labels
+ * @ndd: container of dpa-resource-root + labels
  * @label_id: dpa resource name of the form pmem-
  */
 resource_size_t nvdimm_allocated_dpa(struct nvdimm_drvdata *ndd,
-- 
2.20.1.7.g153144c




[PATCH -next] nvdimm/btt: Fix btt_init() kernel-doc comment

2021-12-30 Thread Yang Li
Add the description of @nd_region and remove @maxlane in
btt_init() kernel-doc comment to remove warnings found
by running scripts/kernel-doc, which is caused by using 'make W=1'.
drivers/nvdimm/btt.c:1584: warning: Function parameter or member
'nd_region' not described in 'btt_init'
drivers/nvdimm/btt.c:1584: warning: Excess function parameter 'maxlane'
description in 'btt_init'

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/nvdimm/btt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index da3f007a1211..293b8c107817 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -1567,7 +1567,7 @@ static void btt_blk_cleanup(struct btt *btt)
  * @rawsize:   raw size in bytes of the backing device
  * @lbasize:   lba size of the backing device
  * @uuid:  A uuid for the backing device - this is stored on media
- * @maxlane:   maximum number of parallel requests the device can handle
+ * @nd_region:  region id and number of lanes possible
  *
  * Initialize a Block Translation Table on a backing device to provide
  * single sector power fail atomicity.
-- 
2.20.1.7.g153144c




[PATCH] x86/platform/uv: Fix inconsistent indenting

2021-04-16 Thread Yang Li
Kernel test robot throws below warning ->

smatch warnings:
arch/x86/kernel/apic/x2apic_uv_x.c:111 early_get_pnodeid() warn:
inconsistent indenting

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/x86/kernel/apic/x2apic_uv_x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c 
b/arch/x86/kernel/apic/x2apic_uv_x.c
index 52bc217..3e7534e 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -108,7 +108,7 @@ static void __init early_get_pnodeid(void)
} else if (UVH_RH_GAM_ADDR_MAP_CONFIG) {
union uvh_rh_gam_addr_map_config_u  m_n_config;
 
-   m_n_config.v = uv_early_read_mmr(UVH_RH_GAM_ADDR_MAP_CONFIG);
+   m_n_config.v = uv_early_read_mmr(UVH_RH_GAM_ADDR_MAP_CONFIG);
uv_cpuid.n_skt = m_n_config.s.n_skt;
if (is_uv(UV3))
uv_cpuid.m_skt = m_n_config.s3.m_skt;
-- 
1.8.3.1



[PATCH] ALSA: seq: oss: Fix inconsistent indenting

2021-04-16 Thread Yang Li
Kernel test robot throws below warning ->

smatch warnings:
sound/core/seq/oss/seq_oss_event.c:297 note_on_event() warn:
inconsistent indenting

Fixed the inconsistent indenting.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 sound/core/seq/oss/seq_oss_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/seq/oss/seq_oss_event.c 
b/sound/core/seq/oss/seq_oss_event.c
index 7b7c925..9a42713 100644
--- a/sound/core/seq/oss/seq_oss_event.c
+++ b/sound/core/seq/oss/seq_oss_event.c
@@ -294,7 +294,7 @@
/* set volume to zero -- note off */
//  type = SNDRV_SEQ_EVENT_NOTEOFF;
//else
-   if (info->ch[ch].vel)
+   if (info->ch[ch].vel)
/* sample already started -- volume change */
type = SNDRV_SEQ_EVENT_KEYPRESS;
else
-- 
1.8.3.1



[PATCH] ALSA: isa: Fix inconsistent indenting

2021-04-16 Thread Yang Li
Kernel test robot throws below warning ->

smatch warnings:
sound/isa/opti9xx/opti92x-ad1848.c:191 snd_opti9xx_init() warn:
inconsistent indenting
sound/isa/opti9xx/opti92x-ad1848.c:488 snd_opti9xx_init() warn:
inconsistent indenting

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 sound/isa/opti9xx/opti92x-ad1848.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/isa/opti9xx/opti92x-ad1848.c 
b/sound/isa/opti9xx/opti92x-ad1848.c
index 08e61d9..234f023 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -188,7 +188,7 @@ static int snd_opti9xx_init(struct snd_opti9xx *chip,
chip->mc_base_size = opti9xx_mc_size[hardware];
}
 #else
-   chip->mc_base_size = opti9xx_mc_size[hardware];
+   chip->mc_base_size = opti9xx_mc_size[hardware];
 #endif
 
switch (hardware) {
@@ -485,7 +485,7 @@ static int snd_opti9xx_configure(struct snd_opti9xx *chip,
 #endif /* CS4231 || OPTi93X */
 
 #ifndef OPTi93X
-outb(irq_bits << 3 | dma_bits, chip->wss_base);
+   outb(irq_bits << 3 | dma_bits, chip->wss_base);
 #else /* OPTi93X */
snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits));
 #endif /* OPTi93X */
-- 
1.8.3.1



[PATCH] drm/radeon/si: Fix inconsistent indenting

2021-04-15 Thread Yang Li
Kernel test robot throws below warning ->

smatch warnings:
drivers/gpu/drm/radeon/si.c:4514 si_vm_packet3_cp_dma_check() warn:
inconsistent indenting

Fixed the inconsistent indenting.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/gpu/drm/radeon/si.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 88731b79..d0e94b1 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -4511,7 +4511,7 @@ static int si_vm_packet3_cp_dma_check(u32 *ib, u32 idx)
} else {
for (i = 0; i < (command & 0x1f); i++) {
reg = start_reg + (4 * i);
-   if (!si_vm_reg_valid(reg)) {
+   if (!si_vm_reg_valid(reg)) {
DRM_ERROR("CP DMA Bad DST 
register\n");
return -EINVAL;
}
-- 
1.8.3.1



[PATCH] ASoC: cs35l35: remove unused including

2021-04-14 Thread Yang Li
Fix the following versioncheck warning:
./sound/soc/codecs/cs35l35.c: 12 linux/version.h not needed.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 sound/soc/codecs/cs35l35.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/codecs/cs35l35.c b/sound/soc/codecs/cs35l35.c
index 55d529a..5d361c7 100644
--- a/sound/soc/codecs/cs35l35.c
+++ b/sound/soc/codecs/cs35l35.c
@@ -9,7 +9,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
1.8.3.1



[PATCH] usb: core: remove unused including

2021-04-14 Thread Yang Li
Fix the following versioncheck warning:
./drivers/usb/core/hcd.c: 14 linux/version.h not needed.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/usb/core/hcd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 3f03813..53bc93d 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -11,7 +11,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
1.8.3.1



[PATCH] selftests/bpf: use !E instead of comparing with NULL

2021-04-13 Thread Yang Li
Fix the following coccicheck warnings:
./tools/testing/selftests/bpf/progs/profiler.inc.h:189:7-11: WARNING
comparing pointer to 0, suggest !E
./tools/testing/selftests/bpf/progs/profiler.inc.h:361:7-11: WARNING
comparing pointer to 0, suggest !E
./tools/testing/selftests/bpf/progs/profiler.inc.h:386:14-18: WARNING
comparing pointer to 0, suggest !E
./tools/testing/selftests/bpf/progs/profiler.inc.h:402:14-18: WARNING
comparing pointer to 0, suggest !E
./tools/testing/selftests/bpf/progs/profiler.inc.h:433:7-11: WARNING
comparing pointer to 0, suggest !E
./tools/testing/selftests/bpf/progs/profiler.inc.h:534:14-18: WARNING
comparing pointer to 0, suggest !E
./tools/testing/selftests/bpf/progs/profiler.inc.h:625:7-11: WARNING
comparing pointer to 0, suggest !E
./tools/testing/selftests/bpf/progs/profiler.inc.h:767:7-11: WARNING
comparing pointer to 0, suggest !E

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 tools/testing/selftests/bpf/progs/profiler.inc.h | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h 
b/tools/testing/selftests/bpf/progs/profiler.inc.h
index 4896fdf8..a33066c 100644
--- a/tools/testing/selftests/bpf/progs/profiler.inc.h
+++ b/tools/testing/selftests/bpf/progs/profiler.inc.h
@@ -189,7 +189,7 @@ static INLINE void populate_ancestors(struct task_struct* 
task,
 #endif
for (num_ancestors = 0; num_ancestors < MAX_ANCESTORS; num_ancestors++) 
{
parent = BPF_CORE_READ(parent, real_parent);
-   if (parent == NULL)
+   if (!parent)
break;
ppid = BPF_CORE_READ(parent, tgid);
if (is_init_process(ppid))
@@ -361,7 +361,7 @@ static INLINE void* populate_var_metadata(struct 
var_metadata_t* metadata,
int zero = 0;
struct var_kill_data_t* kill_data = bpf_map_lookup_elem(_heap, 
);
 
-   if (kill_data == NULL)
+   if (!kill_data)
return NULL;
struct task_struct* task = (struct task_struct*)bpf_get_current_task();
 
@@ -386,14 +386,14 @@ static INLINE int trace_var_sys_kill(void* ctx, int tpid, 
int sig)
u32 spid = get_userspace_pid();
struct var_kill_data_arr_t* arr_struct = 
bpf_map_lookup_elem(_tpid_to_data, );
 
-   if (arr_struct == NULL) {
+   if (!arr_struct) {
struct var_kill_data_t* kill_data = get_var_kill_data(ctx, 
spid, tpid, sig);
int zero = 0;
 
-   if (kill_data == NULL)
+   if (!kill_data)
return 0;
arr_struct = bpf_map_lookup_elem(_heap, );
-   if (arr_struct == NULL)
+   if (!arr_struct)
return 0;
bpf_probe_read(_struct->array[0], 
sizeof(arr_struct->array[0]), kill_data);
} else {
@@ -402,7 +402,7 @@ static INLINE int trace_var_sys_kill(void* ctx, int tpid, 
int sig)
if (index == -1) {
struct var_kill_data_t* kill_data =
get_var_kill_data(ctx, spid, tpid, sig);
-   if (kill_data == NULL)
+   if (!kill_data)
return 0;
 #ifdef UNROLL
 #pragma unroll
@@ -433,7 +433,7 @@ static INLINE int trace_var_sys_kill(void* ctx, int tpid, 
int sig)
} else {
struct var_kill_data_t* kill_data =
get_var_kill_data(ctx, spid, tpid, sig);
-   if (kill_data == NULL)
+   if (!kill_data)
return 0;
bpf_probe_read(_struct->array[index],
   sizeof(arr_struct->array[index]),
@@ -534,14 +534,14 @@ static INLINE bool is_dentry_allowed_for_filemod(struct 
dentry* file_dentry,
*device_id = dev_id;
bool* allowed_device = bpf_map_lookup_elem(_devices, _id);
 
-   if (allowed_device == NULL)
+   if (!allowed_device)
return false;
 
u64 ino = BPF_CORE_READ(file_dentry, d_inode, i_ino);
*file_ino = ino;
bool* allowed_file = bpf_map_lookup_elem(_file_inodes, );
 
-   if (allowed_file == NULL)
+   if (!allowed_fil)
if (!is_ancestor_in_allowed_inodes(BPF_CORE_READ(file_dentry, 
d_parent)))
return false;
return true;
@@ -625,7 +625,7 @@ int raw_tracepoint__sched_process_exit(void* ctx)
struct var_kill_data_arr_t* arr_struct = 
bpf_map_lookup_elem(_tpid_to_data, );
struct var_kill_data_t* kill_data = bpf_map_lookup_elem(_heap, 
);
 
-   if (arr_struct == NULL || kill_data == NULL)
+   if (!arr_struct || !kill_data)
goto out;
 
struct task_struct* task = (struct task_struct*)bpf_get_current_task();
@@ -767,7 +767,7 @@ int kprobe_ret__do_filp_open(struct pt_regs* ctx)
 

[PATCH] Drivers: hv: vmbus: remove unused including

2021-04-13 Thread Yang Li
Fix the following versioncheck warning:
./drivers/hv/hv.c: 16 linux/version.h not needed.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/hv/hv.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index f202ac7..2c3ae4d 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -13,7 +13,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
1.8.3.1



[PATCH] i2c: busses: remove unused including

2021-04-13 Thread Yang Li
Fix the following versioncheck warnings:
./drivers/i2c/busses/i2c-xgene-slimpro.c: 22 linux/version.h not needed.
./drivers/i2c/busses/i2c-brcmstb.c: 25 linux/version.h not needed.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/i2c/busses/i2c-brcmstb.c   | 1 -
 drivers/i2c/busses/i2c-xgene-slimpro.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
index ba766d2..490ee39 100644
--- a/drivers/i2c/busses/i2c-brcmstb.c
+++ b/drivers/i2c/busses/i2c-brcmstb.c
@@ -22,7 +22,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #define N_DATA_REGS8
 
diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c 
b/drivers/i2c/busses/i2c-xgene-slimpro.c
index 63cbb9c7..bba08cb 100644
--- a/drivers/i2c/busses/i2c-xgene-slimpro.c
+++ b/drivers/i2c/busses/i2c-xgene-slimpro.c
@@ -19,7 +19,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #define MAILBOX_OP_TIMEOUT 1000/* Operation time out in ms */
 #define MAILBOX_I2C_INDEX  0
-- 
1.8.3.1



[PATCH] rsi: remove unused including

2021-04-13 Thread Yang Li
Fix the following versioncheck warning:
./drivers/net/wireless/rsi/rsi_91x_ps.c: 19 linux/version.h not needed.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/net/wireless/rsi/rsi_91x_ps.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_ps.c 
b/drivers/net/wireless/rsi/rsi_91x_ps.c
index fdaa5a7..a029049 100644
--- a/drivers/net/wireless/rsi/rsi_91x_ps.c
+++ b/drivers/net/wireless/rsi/rsi_91x_ps.c
@@ -16,7 +16,6 @@
 
 #include 
 #include 
-#include 
 #include "rsi_debugfs.h"
 #include "rsi_mgmt.h"
 #include "rsi_common.h"
-- 
1.8.3.1



[PATCH v2] scsi: qlogicpti: remove unneeded semicolon

2021-04-12 Thread Yang Li
Eliminate the following coccicheck warning:
./drivers/scsi/qlogicpti.c:1153:3-4: Unneeded semicolon

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---

Change in v2:
--One patch per driver

 drivers/scsi/qlogicpti.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index d84e218..3da58263 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -1150,7 +1150,7 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct 
qlogicpti *qpti)
case COMMAND_ERROR:
case COMMAND_PARAM_ERROR:
break;
-   };
+   }
sbus_writew(0, qpti->qregs + SBUS_SEMAPHORE);
}
 
-- 
1.8.3.1



[PATCH v2] scsi: pmcraid: remove unneeded semicolon

2021-04-12 Thread Yang Li
Eliminate the following coccicheck warning:
./drivers/scsi/pmcraid.c:5090:2-3: Unneeded semicolon

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---

Change in v2:
--One patch per driver

 drivers/scsi/pmcraid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 834556e..44e9709 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -5087,7 +5087,7 @@ static int pmcraid_init_instance(struct pci_dev *pdev, 
struct Scsi_Host *host,
mapped_pci_addr + chip_cfg->ioa_host_mask_clr;
pint_regs->global_interrupt_mask_reg =
mapped_pci_addr + chip_cfg->global_intr_mask;
-   };
+   }
 
pinstance->ioa_reset_attempts = 0;
init_waitqueue_head(>reset_wait_q);
-- 
1.8.3.1



[PATCH v2] scsi: ipr: remove unneeded semicolon

2021-04-12 Thread Yang Li
Eliminate the following coccicheck warning:
./drivers/scsi/ipr.h:1979:2-3: Unneeded semicolon

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---

Change in v2:
--One patch per driver

 drivers/scsi/ipr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h
index 783ee03..6c29113 100644
--- a/drivers/scsi/ipr.h
+++ b/drivers/scsi/ipr.h
@@ -1976,7 +1976,7 @@ static inline int ipr_sdt_is_fmt2(u32 sdt_word)
case IPR_SDT_FMT2_BAR5_SEL:
case IPR_SDT_FMT2_EXP_ROM_SEL:
return 1;
-   };
+   }
 
return 0;
 }
-- 
1.8.3.1



[PATCH v2] scsi: aha1542: remove unneeded semicolon

2021-04-12 Thread Yang Li
Eliminate the following coccicheck warning:
./drivers/scsi/aha1542.c:297:2-3: Unneeded semicolon
./drivers/scsi/aha1542.c:339:3-4: Unneeded semicolon
./drivers/scsi/aha1542.c:404:2-3: Unneeded semicolon
./drivers/scsi/aha1542.c:505:3-4: Unneeded semicolon
./drivers/scsi/aha1542.c:516:2-3: Unneeded semicolon
./drivers/scsi/aha1542.c:551:2-3: Unneeded semicolon
./drivers/scsi/aha1542.c:566:2-3: Unneeded semicolon
./drivers/scsi/aha1542.c:595:2-3: Unneeded semicolon
./drivers/scsi/aha1542.c:618:2-3: Unneeded semicolon
./drivers/scsi/aha1542.c:653:2-3: Unneeded semicolon
./drivers/scsi/aha1542.c:671:2-3: Unneeded semicolon
./drivers/scsi/aha1542.c:690:2-3: Unneeded semicolon

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---

Changes in v2:
--One patch per driver

 drivers/scsi/aha1542.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 21aab9f..634f6ab 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -297,7 +297,7 @@ static irqreturn_t aha1542_interrupt(int irq, void *dev_id)
if (flag & SCRD)
printk("SCRD ");
printk("status %02x\n", inb(STATUS(sh->io_port)));
-   };
+   }
 #endif
number_serviced = 0;
 
@@ -339,7 +339,7 @@ static irqreturn_t aha1542_interrupt(int irq, void *dev_id)
if (!number_serviced)
shost_printk(KERN_WARNING, sh, "interrupt 
received, but no mail.\n");
return IRQ_HANDLED;
-   };
+   }
 
mbo = (scsi2int(mb[mbi].ccbptr) - (unsigned 
long)aha1542->ccb_handle) / sizeof(struct ccb);
mbistatus = mb[mbi].status;
@@ -404,7 +404,7 @@ static irqreturn_t aha1542_interrupt(int irq, void *dev_id)
 */
my_done(tmp_cmd);
number_serviced++;
-   };
+   }
 }
 
 static int aha1542_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
@@ -505,7 +505,7 @@ static int aha1542_queuecommand(struct Scsi_Host *sh, 
struct scsi_cmnd *cmd)
scsi_for_each_sg(cmd, sg, sg_count, i) {
any2scsi(acmd->chain[i].dataptr, sg_dma_address(sg));
any2scsi(acmd->chain[i].datalen, sg_dma_len(sg));
-   };
+   }
any2scsi(ccb[mbo].datalen, sg_count * sizeof(struct chain));
any2scsi(ccb[mbo].dataptr, acmd->chain_handle);
 #ifdef DEBUG
@@ -516,7 +516,7 @@ static int aha1542_queuecommand(struct Scsi_Host *sh, 
struct scsi_cmnd *cmd)
ccb[mbo].op = 0;/* SCSI Initiator Command */
any2scsi(ccb[mbo].datalen, 0);
any2scsi(ccb[mbo].dataptr, 0);
-   };
+   }
ccb[mbo].idlun = (target & 7) << 5 | direction | (lun & 7); /*SCSI 
Target Id */
ccb[mbo].rsalen = 16;
ccb[mbo].linkptr[0] = ccb[mbo].linkptr[1] = ccb[mbo].linkptr[2] = 0;
@@ -551,7 +551,7 @@ static void setup_mailboxes(struct Scsi_Host *sh)
any2scsi(aha1542->mb[i].ccbptr,
 aha1542->ccb_handle + i * sizeof(struct ccb));
aha1542->mb[AHA1542_MAILBOXES + i].status = 0;
-   };
+   }
aha1542_intr_reset(sh->io_port);/* reset interrupts, so they 
don't block */
any2scsi(mb_cmd + 2, aha1542->mb_handle);
if (aha1542_out(sh->io_port, mb_cmd, 5))
@@ -566,7 +566,7 @@ static int aha1542_getconfig(struct Scsi_Host *sh)
i = inb(STATUS(sh->io_port));
if (i & DF) {
i = inb(DATA(sh->io_port));
-   };
+   }
aha1542_outb(sh->io_port, CMD_RETCONF);
aha1542_in(sh->io_port, inquiry_result, 3, 0);
if (!wait_mask(INTRFLAGS(sh->io_port), INTRMASK, HACC, 0, 0))
@@ -595,7 +595,7 @@ static int aha1542_getconfig(struct Scsi_Host *sh)
default:
shost_printk(KERN_ERR, sh, "Unable to determine DMA 
channel.\n");
return -1;
-   };
+   }
switch (inquiry_result[1]) {
case 0x40:
sh->irq = 15;
@@ -618,7 +618,7 @@ static int aha1542_getconfig(struct Scsi_Host *sh)
default:
shost_printk(KERN_ERR, sh, "Unable to determine IRQ level.\n");
return -1;
-   };
+   }
sh->this_id = inquiry_result[2] & 7;
return 0;
 }
@@ -653,7 +653,7 @@ static int aha1542_mbenable(struct Scsi_Host *sh)
 
if (aha1542_out(sh->io_port, mbenable_cmd, 3))
goto fail;
-   };
+   }
while (0) {
 fail:
shost_printk(KERN_ERR, sh, "Mailbox init failed\n");
@@ -671,7 +671,7 @@ static int aha1542_query(struct Scsi_Host *sh)
i = in

[tip: x86/cleanups] x86/cacheinfo: Remove unneeded dead-store initialization

2021-04-07 Thread tip-bot2 for Yang Li
The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID: dda451f391eee5d68db3ca87fd8b2a42c8c2b507
Gitweb:
https://git.kernel.org/tip/dda451f391eee5d68db3ca87fd8b2a42c8c2b507
Author:Yang Li 
AuthorDate:Wed, 31 Mar 2021 16:00:24 +08:00
Committer: Borislav Petkov 
CommitterDate: Wed, 07 Apr 2021 21:12:12 +02:00

x86/cacheinfo: Remove unneeded dead-store initialization

$ make CC=clang clang-analyzer

(needs clang-tidy installed on the system too)

on x86_64 defconfig triggers:

  arch/x86/kernel/cpu/cacheinfo.c:880:24: warning: Value stored to 
'this_cpu_ci' \
  during its initialization is never read 
[clang-analyzer-deadcode.DeadStores]
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
  ^
  arch/x86/kernel/cpu/cacheinfo.c:880:24: note: Value stored to 'this_cpu_ci' \
during its initialization is never read

So simply remove this unneeded dead-store initialization.

As compilers will detect this unneeded assignment and optimize this
anyway the resulting object code is identical before and after this
change.

No functional change. No change to object code.

 [ bp: Massage commit message. ]

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
Signed-off-by: Borislav Petkov 
Reviewed-by: Nick Desaulniers 
Link: 
https://lkml.kernel.org/r/1617177624-24670-1-git-send-email-yang@linux.alibaba.com
---
 arch/x86/kernel/cpu/cacheinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c
index 3ca9be4..d66af29 100644
--- a/arch/x86/kernel/cpu/cacheinfo.c
+++ b/arch/x86/kernel/cpu/cacheinfo.c
@@ -877,7 +877,7 @@ void init_intel_cacheinfo(struct cpuinfo_x86 *c)
 static int __cache_amd_cpumap_setup(unsigned int cpu, int index,
struct _cpuid4_info_regs *base)
 {
-   struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
+   struct cpu_cacheinfo *this_cpu_ci;
struct cacheinfo *this_leaf;
int i, sibling;
 


[PATCH] media: uvc: remove unused including

2021-04-05 Thread Yang Li
Fix the following versioncheck warning:
./drivers/media/usb/uvc/uvc_driver.c: 19 linux/version.h not needed.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/media/usb/uvc/uvc_driver.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/usb/uvc/uvc_driver.c 
b/drivers/media/usb/uvc/uvc_driver.c
index 30ef2a3..9f9473d 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -16,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
-- 
1.8.3.1



[PATCH] um: remove unused including

2021-04-05 Thread Yang Li
Fix the following versioncheck warning:
./arch/um/drivers/vector_kern.c: 11 linux/version.h not needed.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/um/drivers/vector_kern.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
index 47a02e6..d27a2a9 100644
--- a/arch/um/drivers/vector_kern.c
+++ b/arch/um/drivers/vector_kern.c
@@ -8,7 +8,6 @@
  * Copyright (C) 2001 by various other people who didn't put their name here.
  */
 
-#include 
 #include 
 #include 
 #include 
-- 
1.8.3.1



[PATCH] x86/hyperv: remove unused including

2021-04-05 Thread Yang Li
Fix the following versioncheck warning:
./arch/x86/hyperv/hv_proc.c: 3 linux/version.h not needed.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/x86/hyperv/hv_proc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/hyperv/hv_proc.c b/arch/x86/hyperv/hv_proc.c
index 60461e5..27e17ad 100644
--- a/arch/x86/hyperv/hv_proc.c
+++ b/arch/x86/hyperv/hv_proc.c
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
1.8.3.1



[PATCH] csky: remove unused including

2021-04-05 Thread Yang Li
Fix the following versioncheck warnings:
./arch/csky/include/asm/io.h: 8 linux/version.h not needed.
./arch/csky/include/asm/uaccess.h: 14 linux/version.h not needed.
./arch/csky/kernel/process.c: 5 linux/version.h not needed.
./arch/csky/mm/dma-mapping.c: 12 linux/version.h not needed.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/csky/include/asm/io.h  | 1 -
 arch/csky/include/asm/uaccess.h | 1 -
 arch/csky/kernel/process.c  | 1 -
 arch/csky/mm/dma-mapping.c  | 1 -
 4 files changed, 4 deletions(-)

diff --git a/arch/csky/include/asm/io.h b/arch/csky/include/asm/io.h
index f826540..ed53f0b 100644
--- a/arch/csky/include/asm/io.h
+++ b/arch/csky/include/asm/io.h
@@ -5,7 +5,6 @@
 
 #include 
 #include 
-#include 
 
 /*
  * I/O memory access primitives. Reads are ordered relative to any
diff --git a/arch/csky/include/asm/uaccess.h b/arch/csky/include/asm/uaccess.h
index 3dec272..841e421 100644
--- a/arch/csky/include/asm/uaccess.h
+++ b/arch/csky/include/asm/uaccess.h
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 static inline int access_ok(const void *addr, unsigned long size)
diff --git a/arch/csky/kernel/process.c b/arch/csky/kernel/process.c
index 3d0ca22..5de0470 100644
--- a/arch/csky/kernel/process.c
+++ b/arch/csky/kernel/process.c
@@ -2,7 +2,6 @@
 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/arch/csky/mm/dma-mapping.c b/arch/csky/mm/dma-mapping.c
index c3a775a..8244702 100644
--- a/arch/csky/mm/dma-mapping.c
+++ b/arch/csky/mm/dma-mapping.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 static inline void cache_op(phys_addr_t paddr, size_t size,
-- 
1.8.3.1



[PATCH] powerpc/pseries: remove unneeded semicolon

2021-04-05 Thread Yang Li
Eliminate the following coccicheck warning:
./arch/powerpc/platforms/pseries/lpar.c:1633:2-3: Unneeded semicolon

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/powerpc/platforms/pseries/lpar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/lpar.c 
b/arch/powerpc/platforms/pseries/lpar.c
index 3805519..705ddf9 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -1630,7 +1630,7 @@ static int pseries_lpar_resize_hpt(unsigned long shift)
}
msleep(delay);
rc = plpar_resize_hpt_prepare(0, shift);
-   };
+   }
 
switch (rc) {
case H_SUCCESS:
-- 
1.8.3.1



[PATCH] rapidio/rio_cm: Remove an unused variable 'rc'

2021-04-02 Thread Yang Li
Fixes the following W=1 kernel build warning(s):
drivers/rapidio/rio_cm.c:673:7: warning: variable ???rc??? set but not used

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/rapidio/rio_cm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/rapidio/rio_cm.c b/drivers/rapidio/rio_cm.c
index 50ec53d..c6fd181 100644
--- a/drivers/rapidio/rio_cm.c
+++ b/drivers/rapidio/rio_cm.c
@@ -670,13 +670,12 @@ static void rio_txcq_handler(struct cm_dev *cm, int slot)
 */
if (!list_empty(>tx_reqs) && (cm->tx_cnt < RIOCM_TX_RING_SIZE)) {
struct tx_req *req, *_req;
-   int rc;
 
list_for_each_entry_safe(req, _req, >tx_reqs, node) {
list_del(>node);
cm->tx_buf[cm->tx_slot] = req->buffer;
-   rc = rio_add_outb_message(cm->mport, req->rdev, cmbox,
- req->buffer, req->len);
+   rio_add_outb_message(cm->mport, req->rdev, cmbox,
+req->buffer, req->len);
kfree(req->buffer);
kfree(req);
 
-- 
1.8.3.1



[PATCH] HID: intel-ish-hid: Remove an unused variable 'ret'

2021-04-02 Thread Yang Li
Fixes the following W=1 kernel build warning(s):

drivers/hid/intel-ish-hid/ipc/pci-ish.c:264:6: warning: variable ???ret???
set but not used

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/hid/intel-ish-hid/ipc/pci-ish.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c 
b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
index 06081cf..61efc30 100644
--- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c
+++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
@@ -261,7 +261,6 @@ static void __maybe_unused ish_resume_handler(struct 
work_struct *work)
struct pci_dev *pdev = to_pci_dev(ish_resume_device);
struct ishtp_device *dev = pci_get_drvdata(pdev);
uint32_t fwsts = dev->ops->get_fw_status(dev);
-   int ret;
 
if (ish_should_leave_d0i3(pdev) && !dev->suspend_flag
&& IPC_IS_ISH_ILUP(fwsts)) {
@@ -273,7 +272,7 @@ static void __maybe_unused ish_resume_handler(struct 
work_struct *work)
 
/* Waiting to get resume response */
if (dev->resume_flag)
-   ret = wait_event_interruptible_timeout(dev->resume_wait,
+   wait_event_interruptible_timeout(dev->resume_wait,
!dev->resume_flag,
msecs_to_jiffies(WAIT_FOR_RESUME_ACK_MS));
 
-- 
1.8.3.1



[PATCH] mmc: moxart: Remove unused variable 'dma_time' and 'pio_time'

2021-04-02 Thread Yang Li
Fixes the following W=1 kernel build warning(s):

drivers/mmc/host/moxart-mmc.c:257:7: warning: variable ???dma_time??? set
but not used
drivers/mmc/host/moxart-mmc.c:395:7: warning: variable ???pio_time??? set
but not used

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/mmc/host/moxart-mmc.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c
index 89bff4e..bde2988 100644
--- a/drivers/mmc/host/moxart-mmc.c
+++ b/drivers/mmc/host/moxart-mmc.c
@@ -257,7 +257,6 @@ static void moxart_dma_complete(void *param)
 static void moxart_transfer_dma(struct mmc_data *data, struct moxart_host 
*host)
 {
u32 len, dir_slave;
-   long dma_time;
struct dma_async_tx_descriptor *desc = NULL;
struct dma_chan *dma_chan;
 
@@ -294,8 +293,8 @@ static void moxart_transfer_dma(struct mmc_data *data, 
struct moxart_host *host)
 
data->bytes_xfered += host->data_remain;
 
-   dma_time = wait_for_completion_interruptible_timeout(
-  >dma_complete, host->timeout);
+   wait_for_completion_interruptible_timeout(>dma_complete,
+ host->timeout);
 
dma_unmap_sg(dma_chan->device->dev,
 data->sg, data->sg_len,
@@ -395,7 +394,6 @@ static void moxart_prepare_data(struct moxart_host *host)
 static void moxart_request(struct mmc_host *mmc, struct mmc_request *mrq)
 {
struct moxart_host *host = mmc_priv(mmc);
-   long pio_time;
unsigned long flags;
u32 status;
 
@@ -431,8 +429,8 @@ static void moxart_request(struct mmc_host *mmc, struct 
mmc_request *mrq)
spin_unlock_irqrestore(>lock, flags);
 
/* PIO transfers start from interrupt. */
-   pio_time = wait_for_completion_interruptible_timeout(
-  >pio_complete, host->timeout);
+   
wait_for_completion_interruptible_timeout(>pio_complete,
+ 
host->timeout);
 
spin_lock_irqsave(>lock, flags);
}
-- 
1.8.3.1



[PATCH] coda: Remove various instances of an unused variable 'outp'

2021-04-02 Thread Yang Li
Fixes the following W=1 kernel build warning(s):
fs/coda/upcall.c:112:20: warning: variable ‘outp’ set but not used
fs/coda/upcall.c:161:20: warning: variable ‘outp’ set but not used
fs/coda/upcall.c:235:20: warning: variable ‘outp’ set but not used
fs/coda/upcall.c:303:20: warning: variable ‘outp’ set but not used
fs/coda/upcall.c:326:20: warning: variable ‘outp’ set but not used
fs/coda/upcall.c:380:20: warning: variable ‘outp’ set but not used
fs/coda/upcall.c:407:20: warning: variable ‘outp’ set but not used
fs/coda/upcall.c:440:20: warning: variable ‘outp’ set but not used
fs/coda/upcall.c:456:20: warning: variable ‘outp’ set but not used
fs/coda/upcall.c:574:20: warning: variable ‘outp’ set but not used

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 fs/coda/upcall.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
index eb3b189..e8db310 100644
--- a/fs/coda/upcall.c
+++ b/fs/coda/upcall.c
@@ -112,7 +112,6 @@ int venus_setattr(struct super_block *sb, struct CodaFid 
*fid,
  struct coda_vattr *vattr)
 {
 union inputArgs *inp;
-union outputArgs *outp;
 int insize, outsize, error;

insize = SIZE(setattr);
@@ -161,7 +160,6 @@ int venus_close(struct super_block *sb, struct CodaFid 
*fid, int flags,
kuid_t uid)
 {
union inputArgs *inp;
-   union outputArgs *outp;
int insize, outsize, error;

insize = SIZE(release);
@@ -235,7 +233,6 @@ int venus_rename(struct super_block *sb, struct CodaFid 
*old_fid,
 const char *new_name)
 {
union inputArgs *inp;
-union outputArgs *outp;
 int insize, outsize, error; 
int offset, s;

@@ -303,7 +300,6 @@ int venus_rmdir(struct super_block *sb, struct CodaFid 
*dirfid,
const char *name, int length)
 {
 union inputArgs *inp;
-union outputArgs *outp;
 int insize, outsize, error;
 int offset;
 
@@ -326,7 +322,6 @@ int venus_remove(struct super_block *sb, struct CodaFid 
*dirfid,
const char *name, int length)
 {
 union inputArgs *inp;
-union outputArgs *outp;
 int error=0, insize, outsize, offset;
 
 offset = INSIZE(remove);
@@ -380,7 +375,6 @@ int venus_link(struct super_block *sb, struct CodaFid *fid,
  struct CodaFid *dirfid, const char *name, int len )
 {
 union inputArgs *inp;
-union outputArgs *outp;
 int insize, outsize, error;
 int offset;
 
@@ -407,7 +401,6 @@ int venus_symlink(struct super_block *sb, struct CodaFid 
*fid,
 const char *symname, int symlen)
 {
 union inputArgs *inp;
-union outputArgs *outp;
 int insize, outsize, error;
 int offset, s;
 
@@ -440,7 +433,6 @@ int venus_symlink(struct super_block *sb, struct CodaFid 
*fid,
 int venus_fsync(struct super_block *sb, struct CodaFid *fid)
 {
 union inputArgs *inp;
-union outputArgs *outp; 
int insize, outsize, error;

insize=SIZE(fsync);
@@ -456,7 +448,6 @@ int venus_fsync(struct super_block *sb, struct CodaFid *fid)
 int venus_access(struct super_block *sb, struct CodaFid *fid, int mask)
 {
 union inputArgs *inp;
-union outputArgs *outp; 
int insize, outsize, error;
 
insize = SIZE(access);
@@ -574,7 +565,6 @@ int venus_access_intent(struct super_block *sb, struct 
CodaFid *fid,
size_t count, loff_t ppos, int type)
 {
union inputArgs *inp;
-   union outputArgs *outp;
int insize, outsize, error;
bool finalizer =
type == CODA_ACCESS_TYPE_READ_FINISH ||
-- 
1.8.3.1



[PATCH] KVM: x86: Fix potential memory access error

2021-03-31 Thread Yang Li
Using __set_bit() to set a bit in an integer is not a good idea, since
the function expects an unsigned long as argument, which can be 64bit wide.
Coverity reports this problem as

High:Out-of-bounds access(INCOMPATIBLE_CAST)
CWE119: Out-of-bounds access to a scalar
Pointer ">arch.regs_avail" points to an object whose effective
type is "unsigned int" (32 bits, unsigned) but is dereferenced as a
wider "unsigned long" (64 bits, unsigned). This may lead to memory
corruption.

/home/heyuan.shy/git-repo/linux/arch/x86/kvm/kvm_cache_regs.h:
kvm_register_is_available

Just use BIT instead.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/x86/kvm/kvm_cache_regs.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/kvm_cache_regs.h b/arch/x86/kvm/kvm_cache_regs.h
index 2e11da2..cfa45d88 100644
--- a/arch/x86/kvm/kvm_cache_regs.h
+++ b/arch/x86/kvm/kvm_cache_regs.h
@@ -52,14 +52,14 @@ static inline bool kvm_register_is_dirty(struct kvm_vcpu 
*vcpu,
 static inline void kvm_register_mark_available(struct kvm_vcpu *vcpu,
   enum kvm_reg reg)
 {
-   __set_bit(reg, (unsigned long *)>arch.regs_avail);
+   vcpu->arch.regs_avail |= BIT(reg);
 }
 
 static inline void kvm_register_mark_dirty(struct kvm_vcpu *vcpu,
   enum kvm_reg reg)
 {
-   __set_bit(reg, (unsigned long *)>arch.regs_avail);
-   __set_bit(reg, (unsigned long *)>arch.regs_dirty);
+   vcpu->arch.regs_avail |= BIT(reg);
+   vcpu->arch.regs_dirty |= BIT(reg);
 }
 
 static inline unsigned long kvm_register_read(struct kvm_vcpu *vcpu, int reg)
-- 
1.8.3.1



[PATCH] rtlwifi: rtl8188ee: remove redundant assignment of variable rtlpriv->btcoexist.reg_bt_sco

2021-03-31 Thread Yang Li
Assigning value "3" to "rtlpriv->btcoexist.reg_bt_sco" here, but that
stored value is overwritten before it can be used.

Coverity reports this problem as
CWE563: A value assigned to a variable is never used.
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c:
rtl8188ee_bt_reg_init

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
index 861cc66..bf686a9 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
@@ -2466,8 +2466,6 @@ void rtl8188ee_bt_reg_init(struct ieee80211_hw *hw)
 
/* 0:Low, 1:High, 2:From Efuse. */
rtlpriv->btcoexist.reg_bt_iso = 2;
-   /* 0:Idle, 1:None-SCO, 2:SCO, 3:From Counter. */
-   rtlpriv->btcoexist.reg_bt_sco = 3;
/* 0:Disable BT control A-MPDU, 1:Enable BT control A-MPDU. */
rtlpriv->btcoexist.reg_bt_sco = 0;
 }
-- 
1.8.3.1



[PATCH] x86/kernel: remove unneeded dead-store initialization

2021-03-31 Thread Yang Li
make clang-analyzer on x86_64 defconfig caught my attention with:

arch/x86/kernel/cpu/cacheinfo.c:880:24: warning: Value stored to
'this_cpu_ci' during its initialization is never read
[clang-analyzer-deadcode.DeadStores]
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
^

So, simply remove this unneeded dead-store initialization to make
clang-analyzer happy.

As compilers will detect this unneeded assignment and optimize this anyway,
the resulting object code is identical before and after this change.

No functional change. No change to object code.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/x86/kernel/cpu/cacheinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c
index 3ca9be4..d66af29 100644
--- a/arch/x86/kernel/cpu/cacheinfo.c
+++ b/arch/x86/kernel/cpu/cacheinfo.c
@@ -877,7 +877,7 @@ void init_intel_cacheinfo(struct cpuinfo_x86 *c)
 static int __cache_amd_cpumap_setup(unsigned int cpu, int index,
struct _cpuid4_info_regs *base)
 {
-   struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
+   struct cpu_cacheinfo *this_cpu_ci;
struct cacheinfo *this_leaf;
int i, sibling;
 
-- 
1.8.3.1



[PATCH] x86/mce/dev-mcelog: Fix potential memory access error

2021-03-29 Thread Yang Li
Using set_bit() to set a bit in an integer is not a good idea, since
the function expects an unsigned long as argument, which can be 64bit
wide.
Coverity reports this problem as

High:Out-of-bounds access(INCOMPATIBLE_CAST)
CWE119: Out-of-bounds access to a scalar
Pointer ">flags" points to an object whose effective type is
"unsigned int" (32 bits, unsigned) but is dereferenced as a wider
"unsigned long" (64 bits, unsigned). This may lead to memory corruption.

/home/heyuan.shy/git-repo/linux/arch/x86/kernel/cpu/mce/dev-mcelog.c:
dev_mce_log

Just use BIT instead.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/x86/kernel/cpu/mce/dev-mcelog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mce/dev-mcelog.c 
b/arch/x86/kernel/cpu/mce/dev-mcelog.c
index 100fbee..fd7b1b4 100644
--- a/arch/x86/kernel/cpu/mce/dev-mcelog.c
+++ b/arch/x86/kernel/cpu/mce/dev-mcelog.c
@@ -51,7 +51,7 @@ static int dev_mce_log(struct notifier_block *nb, unsigned 
long val,
 * earlier errors are the more interesting ones:
 */
if (entry >= mcelog->len) {
-   set_bit(MCE_OVERFLOW, (unsigned long *)>flags);
+   mcelog->flags |= BIT(MCE_OVERFLOW);
goto unlock;
}
 
-- 
1.8.3.1



[PATCH] misc: rtsx: check the value returned from a function for errors before being used

2021-03-24 Thread Yang Li
Add missing return value check in pm_runtime_get disabling the
sensor. The issue is reported by coverity with the following error:

Medium:Unchecked return value(CHECKED_RETURN)
CWE252: Value returned from a function is not checked for errors before
being used.
Calling "pm_runtime_get" without checking return value.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/misc/cardreader/rtsx_pcr.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/cardreader/rtsx_pcr.c 
b/drivers/misc/cardreader/rtsx_pcr.c
index 2733111..2cc37fd 100644
--- a/drivers/misc/cardreader/rtsx_pcr.c
+++ b/drivers/misc/cardreader/rtsx_pcr.c
@@ -142,13 +142,16 @@ static void rtsx_pm_full_on(struct rtsx_pcr *pcr)
 
 void rtsx_pci_start_run(struct rtsx_pcr *pcr)
 {
+   int status;
/* If pci device removed, don't queue idle work any more */
if (pcr->remove_pci)
return;
 
if (pcr->rtd3_en)
if (pcr->is_runtime_suspended) {
-   pm_runtime_get(&(pcr->pci->dev));
+   status = pm_runtime_get(&(pcr->pci->dev));
+   if (status < 0 && status != -EINPROGRESS)
+   pm_runtime_put_noidle(&(pcr->pci->dev));
pcr->is_runtime_suspended = false;
}
 
-- 
1.8.3.1



[PATCH] genirq: Add missing IRQF_ONESHOT

2021-03-23 Thread Yang Li
fixed the following coccicheck:
./kernel/irq/manage.c:2193:8-28: ERROR: Threaded IRQ with no primary
handler requested without IRQF_ONESHOT

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 kernel/irq/manage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 21ea370..a309fd3 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -2191,7 +2191,7 @@ int request_any_context_irq(unsigned int irq, 
irq_handler_t handler,
 
if (irq_settings_is_nested_thread(desc)) {
ret = request_threaded_irq(irq, NULL, handler,
-  flags, name, dev_id);
+  flags | IRQF_ONESHOT, name, dev_id);
return !ret ? IRQC_IS_NESTED : ret;
}
 
-- 
1.8.3.1



[PATCH v2] drm/omap: dsi: Add missing IRQF_ONESHOT

2021-03-23 Thread Yang Li
fixed the following coccicheck:
./drivers/gpu/drm/omapdrm/dss/dsi.c:4329:7-27: ERROR: Threaded IRQ with
no primary handler requested without IRQF_ONESHOT

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---

Change in v2:
-Modify the fourth parameter, not the first

 drivers/gpu/drm/omapdrm/dss/dsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index b31d750..5f1722b 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4327,7 +4327,8 @@ static int omap_dsi_register_te_irq(struct dsi_data *dsi,
irq_set_status_flags(te_irq, IRQ_NOAUTOEN);
 
err = request_threaded_irq(te_irq, NULL, omap_dsi_te_irq_handler,
-  IRQF_TRIGGER_RISING, "TE", dsi);
+  IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+  "TE", dsi);
if (err) {
dev_err(dsi->dev, "request irq failed with %d\n", err);
gpiod_put(dsi->te_gpio);
-- 
1.8.3.1



[PATCH] drm/omap: dsi: Add missing IRQF_ONESHOT

2021-03-22 Thread Yang Li
fixed the following coccicheck:
./drivers/gpu/drm/omapdrm/dss/dsi.c:4329:7-27: ERROR: Threaded IRQ with
no primary handler requested without IRQF_ONESHOT

Make sure threaded IRQs without a primary handler are always request
with IRQF_ONESHOT

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index b31d750..844cb0b 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4326,7 +4326,7 @@ static int omap_dsi_register_te_irq(struct dsi_data *dsi,
 
irq_set_status_flags(te_irq, IRQ_NOAUTOEN);
 
-   err = request_threaded_irq(te_irq, NULL, omap_dsi_te_irq_handler,
+   err = request_threaded_irq(te_irq | IRQF_ONESHOT, NULL, 
omap_dsi_te_irq_handler,
   IRQF_TRIGGER_RISING, "TE", dsi);
if (err) {
dev_err(dsi->dev, "request irq failed with %d\n", err);
-- 
1.8.3.1



[PATCH] riscv: remove unneeded semicolon

2021-03-22 Thread Yang Li
Eliminate the following coccicheck warning:
./arch/riscv/mm/kasan_init.c:219:2-3: Unneeded semicolon

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/riscv/mm/kasan_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/mm/kasan_init.c b/arch/riscv/mm/kasan_init.c
index 4f85c6d..937d13c 100644
--- a/arch/riscv/mm/kasan_init.c
+++ b/arch/riscv/mm/kasan_init.c
@@ -216,7 +216,7 @@ void __init kasan_init(void)
break;
 
kasan_populate(kasan_mem_to_shadow(start), 
kasan_mem_to_shadow(end));
-   };
+   }
 
for (i = 0; i < PTRS_PER_PTE; i++)
set_pte(_early_shadow_pte[i],
-- 
1.8.3.1



[PATCH] drm/gma500: use NULL instead of using plain integer as pointer

2021-03-17 Thread Yang Li
This fixes the following sparse warnings:
drivers/gpu/drm/gma500/psb_drv.c:303:56: warning: Using plain integer as
NULL pointer

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/gpu/drm/gma500/psb_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 0bcab06..c2aab62 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -303,7 +303,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned 
long flags)
 
ret = -ENOMEM;
 
-   dev_priv->mmu = psb_mmu_driver_init(dev, 1, 0, 0);
+   dev_priv->mmu = psb_mmu_driver_init(dev, 1, 0, NULL);
if (!dev_priv->mmu)
goto out_err;
 
-- 
1.8.3.1



[PATCH] EDAC: use NULL instead of using plain integer as pointer

2021-03-17 Thread Yang Li
This fixes the following sparse warnings:
drivers/edac/sb_edac.c:433:10: warning: Using plain integer as NULL
pointer
drivers/edac/sb_edac.c:499:10: warning: Using plain integer as NULL
pointer
drivers/edac/sb_edac.c:570:10: warning: Using plain integer as NULL
pointer
drivers/edac/sb_edac.c:614:10: warning: Using plain integer as NULL
pointer
drivers/edac/sb_edac.c:680:10: warning: Using plain integer as NULL
pointer

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/edac/sb_edac.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index 93daa42..a99df55 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -433,7 +433,7 @@ struct sbridge_pvt {
 
 static const struct pci_id_table pci_dev_descr_sbridge_table[] = {
PCI_ID_TABLE_ENTRY(pci_dev_descr_sbridge, 
ARRAY_SIZE(pci_dev_descr_sbridge), 1, SANDY_BRIDGE),
-   {0,}/* 0 terminated list. */
+   {NULL,} /* 0 terminated list. */
 };
 
 /* This changes depending if 1HA or 2HA:
@@ -499,7 +499,7 @@ struct sbridge_pvt {
 
 static const struct pci_id_table pci_dev_descr_ibridge_table[] = {
PCI_ID_TABLE_ENTRY(pci_dev_descr_ibridge, 12, 2, IVY_BRIDGE),
-   {0,}/* 0 terminated list. */
+   {NULL,} /* 0 terminated list. */
 };
 
 /* Haswell support */
@@ -570,7 +570,7 @@ struct sbridge_pvt {
 
 static const struct pci_id_table pci_dev_descr_haswell_table[] = {
PCI_ID_TABLE_ENTRY(pci_dev_descr_haswell, 13, 2, HASWELL),
-   {0,}/* 0 terminated list. */
+   {NULL,} /* 0 terminated list. */
 };
 
 /* Knight's Landing Support */
@@ -614,7 +614,7 @@ struct sbridge_pvt {
 
 static const struct pci_id_table pci_dev_descr_knl_table[] = {
PCI_ID_TABLE_ENTRY(pci_dev_descr_knl, ARRAY_SIZE(pci_dev_descr_knl), 1, 
KNIGHTS_LANDING),
-   {0,}
+   {NULL,}
 };
 
 /*
@@ -680,7 +680,7 @@ struct sbridge_pvt {
 
 static const struct pci_id_table pci_dev_descr_broadwell_table[] = {
PCI_ID_TABLE_ENTRY(pci_dev_descr_broadwell, 10, 2, BROADWELL),
-   {0,}/* 0 terminated list. */
+   {NULL,} /* 0 terminated list. */
 };
 
 
-- 
1.8.3.1



[PATCH] um: replace if (cond) BUG() with BUG_ON()

2021-03-17 Thread Yang Li
Fix the following coccinelle reports:
./arch/um/kernel/mem.c:77:3-6: WARNING: Use BUG_ON instead of if
condition followed by BUG.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/um/kernel/mem.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 9242dc9..22e28bf 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -73,8 +73,7 @@ static void __init one_page_table_init(pmd_t *pmd)
 
set_pmd(pmd, __pmd(_KERNPG_TABLE +
   (unsigned long) __pa(pte)));
-   if (pte != pte_offset_kernel(pmd, 0))
-   BUG();
+   BUG_ON(pte != pte_offset_kernel(pmd, 0));
}
 }
 
-- 
1.8.3.1



[PATCH] misc/sgi-xp: use NULL instead of using plain integer as pointer

2021-03-16 Thread Yang Li
This fixes the following sparse warnings:
drivers/misc/sgi-xp/xpc_main.c:210:23: warning: Using plain integer as
NULL pointer

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/misc/sgi-xp/xpc_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index 84610bb..b2c3c22 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -207,7 +207,7 @@
 {
xpc_arch_ops.heartbeat_init();
timer_setup(_hb_timer, xpc_hb_beater, 0);
-   xpc_hb_beater(0);
+   xpc_hb_beater(NULL);
 }
 
 static void
-- 
1.8.3.1



[PATCH] bcache: use NULL instead of using plain integer as pointer

2021-03-16 Thread Yang Li
This fixes the following sparse warnings:
drivers/md/bcache/features.c:22:16: warning: Using plain integer as NULL
pointer

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/md/bcache/features.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/bcache/features.c b/drivers/md/bcache/features.c
index d636b7b..6d2b7b8 100644
--- a/drivers/md/bcache/features.c
+++ b/drivers/md/bcache/features.c
@@ -19,7 +19,7 @@ struct feature {
 static struct feature feature_list[] = {
{BCH_FEATURE_INCOMPAT, BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE,
"large_bucket"},
-   {0, 0, 0 },
+   {0, 0, NULL },
 };
 
 #define compose_feature_string(type)   \
-- 
1.8.3.1



[PATCH] perf tools: use true and false for bool variable

2021-03-15 Thread Yang Li
fixed the following coccicheck:
./tools/perf/util/jitdump.c:803:9-10: WARNING: return of 0/1 in function
'jit_has_pid' with return type bool

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 tools/perf/util/jitdump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c
index 9760d8e..f49a659 100644
--- a/tools/perf/util/jitdump.c
+++ b/tools/perf/util/jitdump.c
@@ -800,7 +800,7 @@ static bool jit_has_pid(struct machine *machine, pid_t pid)
struct thread *thread = machine__find_thread(machine, pid, pid);
 
if (!thread)
-   return 0;
+   return false;
 
return (bool)thread->priv;
 }
-- 
1.8.3.1



[PATCH] x86/pci: use true and false for bool variable

2021-03-15 Thread Yang Li
fixed the following coccicheck:
./arch/x86/pci/mmconfig-shared.c:464:9-10: WARNING: return of 0/1 in
function 'is_mmconf_reserved' with return type bool
./arch/x86/pci/mmconfig-shared.c:493:5-6: WARNING: return of 0/1 in
function 'is_mmconf_reserved' with return type bool
./arch/x86/pci/mmconfig-shared.c:501:9-10: WARNING: return of 0/1 in
function 'is_mmconf_reserved' with return type bool
./arch/x86/pci/mmconfig-shared.c:522:5-6: WARNING: return of 0/1 in
function 'is_mmconf_reserved' with return type bool

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/x86/pci/mmconfig-shared.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index de6bf0e..758cbfe 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -461,7 +461,7 @@ static bool __ref is_mmconf_reserved(check_reserved_t 
is_reserved,
}
 
if (size < (16UL<<20) && size != old_size)
-   return 0;
+   return false;
 
if (dev)
dev_info(dev, "MMCONFIG at %pR reserved in %s\n",
@@ -493,7 +493,7 @@ static bool __ref is_mmconf_reserved(check_reserved_t 
is_reserved,
>res, (unsigned long) cfg->address);
}
 
-   return 1;
+   return true;
 }
 
 static bool __ref
@@ -501,7 +501,7 @@ static bool __ref is_mmconf_reserved(check_reserved_t 
is_reserved,
 {
if (!early && !acpi_disabled) {
if (is_mmconf_reserved(is_acpi_reserved, cfg, dev, 0))
-   return 1;
+   return true;
 
if (dev)
dev_info(dev, FW_INFO
@@ -522,14 +522,14 @@ static bool __ref is_mmconf_reserved(check_reserved_t 
is_reserved,
 * _CBA method, just assume it's reserved.
 */
if (pci_mmcfg_running_state)
-   return 1;
+   return true;
 
/* Don't try to do this check unless configuration
   type 1 is available. how about type 2 ?*/
if (raw_pci_ops)
return is_mmconf_reserved(e820__mapped_all, cfg, dev, 1);
 
-   return 0;
+   return false;
 }
 
 static void __init pci_mmcfg_reject_broken(int early)
-- 
1.8.3.1



[PATCH] powerpc/xive: use true and false for bool variable

2021-03-15 Thread Yang Li
fixed the following coccicheck:
./arch/powerpc/sysdev/xive/spapr.c:552:8-9: WARNING: return of 0/1 in
function 'xive_spapr_match' with return type bool

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/powerpc/sysdev/xive/spapr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/spapr.c
index 01ccc078..f143b6f 100644
--- a/arch/powerpc/sysdev/xive/spapr.c
+++ b/arch/powerpc/sysdev/xive/spapr.c
@@ -549,7 +549,7 @@ static void xive_spapr_cleanup_queue(unsigned int cpu, 
struct xive_cpu *xc,
 static bool xive_spapr_match(struct device_node *node)
 {
/* Ignore cascaded controllers for the moment */
-   return 1;
+   return true;
 }
 
 #ifdef CONFIG_SMP
-- 
1.8.3.1



[PATCH] MIPS: generic: use true and false for bool variable

2021-03-15 Thread Yang Li
fixed the following coccicheck:
./arch/mips/generic/board-ocelot.c:29:9-10: WARNING: return of 0/1 in
function 'ocelot_detect' with return type bool

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/mips/generic/board-ocelot.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/generic/board-ocelot.c b/arch/mips/generic/board-ocelot.c
index c238e95..7115410 100644
--- a/arch/mips/generic/board-ocelot.c
+++ b/arch/mips/generic/board-ocelot.c
@@ -26,13 +26,13 @@ static __init bool ocelot_detect(void)
tlb_probe_hazard();
idx = read_c0_index();
if (idx < 0)
-   return 0;
+   return false;
 
/* A TLB entry exists, lets assume its usable and check the CHIP ID */
rev = __raw_readl((void __iomem *)DEVCPU_GCB_CHIP_REGS_CHIP_ID);
 
if ((rev & CHIP_ID_PART_ID) != OCELOT_PART_ID)
-   return 0;
+   return false;
 
/* Copy command line from bootloader early for Initrd detection */
if (fw_arg0 < 10 && (fw_arg1 & 0xFFF0) == 0x8000) {
@@ -44,7 +44,7 @@ static __init bool ocelot_detect(void)
strcpy(arcs_cmdline, prom_argv[1]);
}
 
-   return 1;
+   return true;
 }
 
 static void __init ocelot_earlyprintk_init(void)
-- 
1.8.3.1



[PATCH] ARM: OMAP2+: use true and false for bool variable

2021-03-15 Thread Yang Li
fixed the following coccicheck:
./arch/arm/mach-omap2/powerdomain.c:1205:9-10: WARNING: return of 0/1 in
function 'pwrdm_can_ever_lose_context' with return type bool

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/arm/mach-omap2/powerdomain.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c 
b/arch/arm/mach-omap2/powerdomain.c
index 1cbac76..0a5b87e 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -1202,26 +1202,26 @@ bool pwrdm_can_ever_lose_context(struct powerdomain 
*pwrdm)
if (!pwrdm) {
pr_debug("powerdomain: %s: invalid powerdomain pointer\n",
 __func__);
-   return 1;
+   return true;
}
 
if (pwrdm->pwrsts & PWRSTS_OFF)
-   return 1;
+   return true;
 
if (pwrdm->pwrsts & PWRSTS_RET) {
if (pwrdm->pwrsts_logic_ret & PWRSTS_OFF)
-   return 1;
+   return true;
 
for (i = 0; i < pwrdm->banks; i++)
if (pwrdm->pwrsts_mem_ret[i] & PWRSTS_OFF)
-   return 1;
+   return true;
}
 
for (i = 0; i < pwrdm->banks; i++)
if (pwrdm->pwrsts_mem_on[i] & PWRSTS_OFF)
-   return 1;
+   return true;
 
-   return 0;
+   return false;
 }
 
 /**
-- 
1.8.3.1



[PATCH] kconfig: use true and false for bool variable

2021-03-15 Thread Yang Li
fixed the following coccicheck:
./scripts/kconfig/confdata.c:36:9-10: WARNING: return of 0/1 in function
'is_dir' with return type bool

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 scripts/kconfig/confdata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 2568dbe..b65b8c3 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -33,7 +33,7 @@ static bool is_dir(const char *path)
struct stat st;
 
if (stat(path, ))
-   return 0;
+   return false;
 
return S_ISDIR(st.st_mode);
 }
-- 
1.8.3.1



[PATCH v2] char/mwave: turn tp3780I_Cleanup() into void function

2021-03-10 Thread Yang Li
This function always return '0' and no callers use the return value.
So make it a void function.

This eliminates the following coccicheck warning:
./drivers/char/mwave/tp3780i.c:182:5-11: Unneeded variable: "retval".
Return "0" on line 187

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---

Change in v2:
-correct the subject line

 drivers/char/mwave/tp3780i.c | 6 +-
 drivers/char/mwave/tp3780i.h | 2 +-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/char/mwave/tp3780i.c b/drivers/char/mwave/tp3780i.c
index 5e1618a..8588b51 100644
--- a/drivers/char/mwave/tp3780i.c
+++ b/drivers/char/mwave/tp3780i.c
@@ -177,14 +177,10 @@ int tp3780I_InitializeBoardData(THINKPAD_BD_DATA * 
pBDData)
return retval;
 }
 
-int tp3780I_Cleanup(THINKPAD_BD_DATA * pBDData)
+void tp3780I_Cleanup(THINKPAD_BD_DATA *pBDData)
 {
-   int retval = 0;
-
PRINTK_2(TRACE_TP3780I,
"tp3780i::tp3780I_Cleanup entry and exit pBDData %p\n", 
pBDData);
-
-   return retval;
 }
 
 int tp3780I_CalcResources(THINKPAD_BD_DATA * pBDData)
diff --git a/drivers/char/mwave/tp3780i.h b/drivers/char/mwave/tp3780i.h
index 07685b6..8bd976d 100644
--- a/drivers/char/mwave/tp3780i.h
+++ b/drivers/char/mwave/tp3780i.h
@@ -91,7 +91,7 @@
 int tp3780I_ResetDSP(THINKPAD_BD_DATA * pBDData);
 int tp3780I_StartDSP(THINKPAD_BD_DATA * pBDData);
 int tp3780I_QueryAbilities(THINKPAD_BD_DATA * pBDData, MW_ABILITIES * 
pAbilities);
-int tp3780I_Cleanup(THINKPAD_BD_DATA * pBDData);
+void tp3780I_Cleanup(THINKPAD_BD_DATA *pBDData);
 int tp3780I_ReadWriteDspDStore(THINKPAD_BD_DATA * pBDData, unsigned int 
uOpcode,
void __user *pvBuffer, unsigned int uCount,
unsigned long ulDSPAddr);
-- 
1.8.3.1



[PATCH] isdn: mISDN: remove unneeded variable 'ret'

2021-03-10 Thread Yang Li
Fix the following coccicheck warning:
./drivers/isdn/mISDN/dsp_core.c:956:6-9: Unneeded variable: "err".
Return "0" on line 1001

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/isdn/mISDN/dsp_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/isdn/mISDN/dsp_core.c b/drivers/isdn/mISDN/dsp_core.c
index 038e72a..4946ea1 100644
--- a/drivers/isdn/mISDN/dsp_core.c
+++ b/drivers/isdn/mISDN/dsp_core.c
@@ -953,7 +953,6 @@
 {
struct dsp  *dsp = container_of(ch, struct dsp, ch);
u_long  flags;
-   int err = 0;
 
if (debug & DEBUG_DSP_CTRL)
printk(KERN_DEBUG "%s:(%x)\n", __func__, cmd);
@@ -998,7 +997,7 @@
module_put(THIS_MODULE);
break;
}
-   return err;
+   return 0;
 }
 
 static void
-- 
1.8.3.1



[PATCH] media: i2c: remove unneeded variable 'ret'

2021-03-10 Thread Yang Li
Fix the following coccicheck warning:
./drivers/media/i2c/ov8865.c:2527:5-8: Unneeded variable: "ret". Return
"0" on line 2536

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/media/i2c/ov8865.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c
index 36a60fb..2db052f 100644
--- a/drivers/media/i2c/ov8865.c
+++ b/drivers/media/i2c/ov8865.c
@@ -2524,7 +2524,6 @@ static int ov8865_g_frame_interval(struct v4l2_subdev 
*subdev,
 {
struct ov8865_sensor *sensor = ov8865_subdev_sensor(subdev);
const struct ov8865_mode *mode;
-   int ret = 0;
 
mutex_lock(>mutex);
 
@@ -2533,7 +2532,7 @@ static int ov8865_g_frame_interval(struct v4l2_subdev 
*subdev,
 
mutex_unlock(>mutex);
 
-   return ret;
+   return 0;
 }
 
 static const struct v4l2_subdev_video_ops ov8865_subdev_video_ops = {
-- 
1.8.3.1



[PATCH] microblaze: remove unneeded variable 'err'

2021-03-10 Thread Yang Li
Fix the following coccicheck warning:
./arch/microblaze/kernel/signal.c:60:14-17: Unneeded variable: "err".
Return "0" on line 78

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/microblaze/kernel/signal.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
index fc61eb0..c4b7b30 100644
--- a/arch/microblaze/kernel/signal.c
+++ b/arch/microblaze/kernel/signal.c
@@ -57,8 +57,6 @@ struct rt_sigframe {
 static int restore_sigcontext(struct pt_regs *regs,
struct sigcontext __user *sc, int *rval_p)
 {
-   unsigned int err = 0;
-
 #define COPY(x){err |= __get_user(regs->x, >regs.x); }
COPY(r0);
COPY(r1);
@@ -75,7 +73,7 @@ static int restore_sigcontext(struct pt_regs *regs,
 
*rval_p = regs->r3;
 
-   return err;
+   return 0;
 }
 
 asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
-- 
1.8.3.1



[PATCH] uml: remove unneeded variable 'ret'

2021-03-10 Thread Yang Li
Fix the following coccicheck warning:
./arch/um/drivers/hostaudio_kern.c:125:10-14: Unneeded variable: "mask".
Return "0" on line 131

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/um/drivers/hostaudio_kern.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c
index d35d3f3..5b064d3 100644
--- a/arch/um/drivers/hostaudio_kern.c
+++ b/arch/um/drivers/hostaudio_kern.c
@@ -122,13 +122,11 @@ static ssize_t hostaudio_write(struct file *file, const 
char __user *buffer,
 static __poll_t hostaudio_poll(struct file *file,
struct poll_table_struct *wait)
 {
-   __poll_t mask = 0;
-
 #ifdef DEBUG
printk(KERN_DEBUG "hostaudio: poll called (unimplemented)\n");
 #endif
 
-   return mask;
+   return 0;
 }
 
 static long hostaudio_ioctl(struct file *file,
-- 
1.8.3.1



[PATCH] char/mwave: turn tp3780I_InitializeBoardData() into void function

2021-03-10 Thread Yang Li
This function always return '0' and no callers use the return value.
So make it a void function.

This eliminates the following coccicheck warning:
./drivers/char/mwave/tp3780i.c:182:5-11: Unneeded variable: "retval".
Return "0" on line 187

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/char/mwave/tp3780i.c | 6 +-
 drivers/char/mwave/tp3780i.h | 2 +-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/char/mwave/tp3780i.c b/drivers/char/mwave/tp3780i.c
index 5e1618a..8588b51 100644
--- a/drivers/char/mwave/tp3780i.c
+++ b/drivers/char/mwave/tp3780i.c
@@ -177,14 +177,10 @@ int tp3780I_InitializeBoardData(THINKPAD_BD_DATA * 
pBDData)
return retval;
 }
 
-int tp3780I_Cleanup(THINKPAD_BD_DATA * pBDData)
+void tp3780I_Cleanup(THINKPAD_BD_DATA *pBDData)
 {
-   int retval = 0;
-
PRINTK_2(TRACE_TP3780I,
"tp3780i::tp3780I_Cleanup entry and exit pBDData %p\n", 
pBDData);
-
-   return retval;
 }
 
 int tp3780I_CalcResources(THINKPAD_BD_DATA * pBDData)
diff --git a/drivers/char/mwave/tp3780i.h b/drivers/char/mwave/tp3780i.h
index 07685b6..8bd976d 100644
--- a/drivers/char/mwave/tp3780i.h
+++ b/drivers/char/mwave/tp3780i.h
@@ -91,7 +91,7 @@
 int tp3780I_ResetDSP(THINKPAD_BD_DATA * pBDData);
 int tp3780I_StartDSP(THINKPAD_BD_DATA * pBDData);
 int tp3780I_QueryAbilities(THINKPAD_BD_DATA * pBDData, MW_ABILITIES * 
pAbilities);
-int tp3780I_Cleanup(THINKPAD_BD_DATA * pBDData);
+void tp3780I_Cleanup(THINKPAD_BD_DATA *pBDData);
 int tp3780I_ReadWriteDspDStore(THINKPAD_BD_DATA * pBDData, unsigned int 
uOpcode,
void __user *pvBuffer, unsigned int uCount,
unsigned long ulDSPAddr);
-- 
1.8.3.1



[PATCH] btrfs: turn btrfs_destroy_delayed_refs() into void function

2021-03-09 Thread Yang Li
This function always return '0' and no callers use the return value.
So make it a void function.

This eliminates the following coccicheck warning:
./fs/btrfs/disk-io.c:4522:5-8: Unneeded variable: "ret". Return "0" on
line 4530

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 fs/btrfs/disk-io.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 41b718c..b75d2d9 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -52,7 +52,7 @@
 
 static void end_workqueue_fn(struct btrfs_work *work);
 static void btrfs_destroy_ordered_extents(struct btrfs_root *root);
-static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
+static void btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
  struct btrfs_fs_info *fs_info);
 static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root);
 static int btrfs_destroy_marked_extents(struct btrfs_fs_info *fs_info,
@@ -4513,13 +4513,12 @@ static void btrfs_destroy_all_ordered_extents(struct 
btrfs_fs_info *fs_info)
btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1);
 }
 
-static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
+static void btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
  struct btrfs_fs_info *fs_info)
 {
struct rb_node *node;
struct btrfs_delayed_ref_root *delayed_refs;
struct btrfs_delayed_ref_node *ref;
-   int ret = 0;
 
delayed_refs = >delayed_refs;
 
@@ -4592,8 +4591,6 @@ static int btrfs_destroy_delayed_refs(struct 
btrfs_transaction *trans,
btrfs_qgroup_destroy_extent_records(trans);
 
spin_unlock(_refs->lock);
-
-   return ret;
 }
 
 static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root)
-- 
1.8.3.1



[PATCH] dm: remove unneeded variable 'sz'

2021-03-09 Thread Yang Li
Fix the following coccicheck warning:
./drivers/md/dm-ps-service-time.c:85:10-12: Unneeded variable: "sz".
Return "0" on line 105

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/md/dm-ps-service-time.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/md/dm-ps-service-time.c b/drivers/md/dm-ps-service-time.c
index 9cfda66..12dd5ce 100644
--- a/drivers/md/dm-ps-service-time.c
+++ b/drivers/md/dm-ps-service-time.c
@@ -82,7 +82,6 @@ static void st_destroy(struct path_selector *ps)
 static int st_status(struct path_selector *ps, struct dm_path *path,
 status_type_t type, char *result, unsigned maxlen)
 {
-   unsigned sz = 0;
struct path_info *pi;
 
if (!path)
@@ -102,7 +101,7 @@ static int st_status(struct path_selector *ps, struct 
dm_path *path,
}
}
 
-   return sz;
+   return 0;
 }
 
 static int st_add_path(struct path_selector *ps, struct dm_path *path,
-- 
1.8.3.1



[PATCH] mmc: via-sdmmc: remove unneeded variable 'ret'

2021-03-08 Thread Yang Li
Fix the following coccicheck warning:
./drivers/mmc/host/via-sdmmc.c:1274:5-8: Unneeded variable: "ret".
Return "0" on line 1295

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/mmc/host/via-sdmmc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mmc/host/via-sdmmc.c b/drivers/mmc/host/via-sdmmc.c
index 4f4c081..a1d0985 100644
--- a/drivers/mmc/host/via-sdmmc.c
+++ b/drivers/mmc/host/via-sdmmc.c
@@ -1271,7 +1271,6 @@ static int __maybe_unused via_sd_suspend(struct device 
*dev)
 static int __maybe_unused via_sd_resume(struct device *dev)
 {
struct via_crdr_mmc_host *sdhost;
-   int ret = 0;
u8 gatt;
 
sdhost = dev_get_drvdata(dev);
@@ -1292,7 +1291,7 @@ static int __maybe_unused via_sd_resume(struct device 
*dev)
via_restore_pcictrlreg(sdhost);
via_init_sdc_pm(sdhost);
 
-   return ret;
+   return 0;
 }
 
 static SIMPLE_DEV_PM_OPS(via_sd_pm_ops, via_sd_suspend, via_sd_resume);
-- 
1.8.3.1



[PATCH] scsi: 3w-sas: remove unneeded variable 'retval'

2021-03-08 Thread Yang Li
Fix the following coccicheck warning:
./drivers/scsi/3w-sas.c:866:5-11: Unneeded variable: "retval". Return
"1" on line 898

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/scsi/3w-sas.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index 3db0e42..eae706e 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -863,7 +863,6 @@ static int twl_fill_sense(TW_Device_Extension *tw_dev, int 
i, int request_id, in
TW_Command_Full *full_command_packet;
unsigned short error;
char *error_str;
-   int retval = 1;
 
header = tw_dev->sense_buffer_virt[i];
full_command_packet = tw_dev->command_packet_virt[request_id];
@@ -895,7 +894,7 @@ static int twl_fill_sense(TW_Device_Extension *tw_dev, int 
i, int request_id, in
goto out;
}
 out:
-   return retval;
+   return 1;
 } /* End twl_fill_sense() */
 
 /* This function will free up device extension resources */
-- 
1.8.3.1



[PATCH] io_uring: remove unneeded variable 'ret'

2021-03-08 Thread Yang Li
Fix the following coccicheck warning:
./fs/io_uring.c:8984:5-8: Unneeded variable: "ret". Return "0" on line
8998

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 fs/io_uring.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 92c25b5..387dbb7 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8981,7 +8981,6 @@ static unsigned long 
io_uring_nommu_get_unmapped_area(struct file *file,
 
 static int io_sqpoll_wait_sq(struct io_ring_ctx *ctx)
 {
-   int ret = 0;
DEFINE_WAIT(wait);
 
do {
@@ -8995,7 +8994,7 @@ static int io_sqpoll_wait_sq(struct io_ring_ctx *ctx)
} while (!signal_pending(current));
 
finish_wait(>sqo_sq_wait, );
-   return ret;
+   return 0;
 }
 
 static int io_get_ext_arg(unsigned flags, const void __user *argp, size_t 
*argsz,
-- 
1.8.3.1



[PATCH] perf symbols: turn dso__fprintf_symbols_by_name into void function

2021-03-08 Thread Yang Li
This function always return '0' and no callers use the return value.
So make it a void function.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 tools/perf/util/dso.h| 2 +-
 tools/perf/util/symbol_fprintf.c | 5 +
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index cd2fe64..d7ebf21 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -364,7 +364,7 @@ struct dso *machine__findnew_kernel(struct machine 
*machine, const char *name,
 
 void dso__reset_find_symbol_cache(struct dso *dso);
 
-size_t dso__fprintf_symbols_by_name(struct dso *dso, FILE *fp);
+void dso__fprintf_symbols_by_name(struct dso *dso, FILE *fp);
 size_t dso__fprintf(struct dso *dso, FILE *fp);
 
 static inline bool dso__is_vmlinux(struct dso *dso)
diff --git a/tools/perf/util/symbol_fprintf.c b/tools/perf/util/symbol_fprintf.c
index 35c936c..031584e 100644
--- a/tools/perf/util/symbol_fprintf.c
+++ b/tools/perf/util/symbol_fprintf.c
@@ -59,10 +59,9 @@ size_t symbol__fprintf_symname(const struct symbol *sym, 
FILE *fp)
return __symbol__fprintf_symname_offs(sym, NULL, false, false, fp);
 }
 
-size_t dso__fprintf_symbols_by_name(struct dso *dso,
+void dso__fprintf_symbols_by_name(struct dso *dso,
FILE *fp)
 {
-   size_t ret = 0;
struct rb_node *nd;
struct symbol_name_rb_node *pos;
 
@@ -70,6 +69,4 @@ size_t dso__fprintf_symbols_by_name(struct dso *dso,
pos = rb_entry(nd, struct symbol_name_rb_node, rb_node);
fprintf(fp, "%s\n", pos->sym.name);
}
-
-   return ret;
 }
-- 
1.8.3.1



[PATCH] sched/fair: Use true and false for bool variable

2021-03-08 Thread Yang Li
Fix the following coccicheck warning:
./kernel/sched/fair.c:9497:9-10: WARNING: return of 0/1 in function
'imbalanced_active_balance' with return type bool

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 kernel/sched/fair.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 794c2cb..5388fde 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9494,9 +9494,9 @@ static struct rq *find_busiest_queue(struct lb_env *env,
 */
if ((env->migration_type == migrate_task) &&
(sd->nr_balance_failed > sd->cache_nice_tries+2))
-   return 1;
+   return true;
 
-   return 0;
+   return false;
 }
 
 static int need_active_balance(struct lb_env *env)
-- 
1.8.3.1



[PATCH] ASoC: bcm: add missing call to of_node_put()

2021-03-07 Thread Yang Li
In one of the error paths of the for_each_child_of_node() loop,
add missing call to of_node_put().

Fix the following coccicheck warning:
./sound/soc/bcm/cygnus-ssp.c:1346:1-33: WARNING: Function
"for_each_available_child_of_node" should have of_node_put() before
return around line 1352.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 sound/soc/bcm/cygnus-ssp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/bcm/cygnus-ssp.c b/sound/soc/bcm/cygnus-ssp.c
index 6e634b4..aa16a23 100644
--- a/sound/soc/bcm/cygnus-ssp.c
+++ b/sound/soc/bcm/cygnus-ssp.c
@@ -1348,8 +1348,10 @@ static int cygnus_ssp_probe(struct platform_device *pdev)
_ssp_dai[active_port_count]);
 
/* negative is err, 0 is active and good, 1 is disabled */
-   if (err < 0)
+   if (err < 0) {
+   of_node_put(child_node);
return err;
+   }
else if (!err) {
dev_dbg(dev, "Activating DAI: %s\n",
cygnus_ssp_dai[active_port_count].name);
-- 
1.8.3.1



[PATCH] phy: hisilicon: add missing call to of_node_put()

2021-03-07 Thread Yang Li
In one of the error paths of the for_each_child_of_node() loop,
add missing call to of_node_put().

Fix the following coccicheck warning:
./drivers/phy/hisilicon/phy-hisi-inno-usb2.c:138:1-23: WARNING: Function
"for_each_child_of_node" should have of_node_put() before break around
line 158.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/phy/hisilicon/phy-hisi-inno-usb2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c 
b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
index 34a6a9a..c58115e 100644
--- a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
+++ b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
@@ -146,8 +146,10 @@ static int hisi_inno_phy_probe(struct platform_device 
*pdev)
priv->ports[i].priv = priv;
 
phy = devm_phy_create(dev, child, _inno_phy_ops);
-   if (IS_ERR(phy))
+   if (IS_ERR(phy)) {
+   of_node_put(child);
return PTR_ERR(phy);
+   }
 
phy_set_bus_width(phy, 8);
phy_set_drvdata(phy, >ports[i]);
-- 
1.8.3.1



[PATCH v2] usb: typec: tcpm: turn tcpm_ams_finish into void function

2021-03-07 Thread Yang Li
This function always return '0' and no callers use the return value.
So make it a void function.

This eliminates the following coccicheck warning:
./drivers/usb/typec/tcpm/tcpm.c:778:5-8: Unneeded variable: "ret".
Return "0" on line 794

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---

Change in v2:
-remove the unnecessary return statement

 drivers/usb/typec/tcpm/tcpm.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index be0b646..8159229 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -773,10 +773,8 @@ static enum typec_cc_status tcpm_rp_cc(struct tcpm_port 
*port)
return TYPEC_CC_RP_DEF;
 }
 
-static int tcpm_ams_finish(struct tcpm_port *port)
+static void tcpm_ams_finish(struct tcpm_port *port)
 {
-   int ret = 0;
-
tcpm_log(port, "AMS %s finished", tcpm_ams_str[port->ams]);
 
if (port->pd_capable && port->pwr_role == TYPEC_SOURCE) {
@@ -790,8 +788,6 @@ static int tcpm_ams_finish(struct tcpm_port *port)
 
port->in_ams = false;
port->ams = NONE_AMS;
-
-   return ret;
 }
 
 static int tcpm_pd_transmit(struct tcpm_port *port,
-- 
1.8.3.1



[PATCH] usb: typec: tcpm: turn tcpm_ams_finish into void function

2021-03-07 Thread Yang Li
This function always return '0' and no callers use the return value.
So make it a void function.

This eliminates the following coccicheck warning:
./drivers/usb/typec/tcpm/tcpm.c:778:5-8: Unneeded variable: "ret".
Return "0" on line 794

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/usb/typec/tcpm/tcpm.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index be0b646..6ee984e 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -773,10 +773,8 @@ static enum typec_cc_status tcpm_rp_cc(struct tcpm_port 
*port)
return TYPEC_CC_RP_DEF;
 }
 
-static int tcpm_ams_finish(struct tcpm_port *port)
+static void tcpm_ams_finish(struct tcpm_port *port)
 {
-   int ret = 0;
-
tcpm_log(port, "AMS %s finished", tcpm_ams_str[port->ams]);
 
if (port->pd_capable && port->pwr_role == TYPEC_SOURCE) {
@@ -791,7 +789,7 @@ static int tcpm_ams_finish(struct tcpm_port *port)
port->in_ams = false;
port->ams = NONE_AMS;
 
-   return ret;
+   return;
 }
 
 static int tcpm_pd_transmit(struct tcpm_port *port,
-- 
1.8.3.1



[PATCH] gfs2: make function gfs2_make_fs_ro() to void type

2021-03-04 Thread Yang Li
It fixes the following warning detected by coccinelle:
./fs/gfs2/super.c:592:5-10: Unneeded variable: "error". Return "0" on
line 628

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 fs/gfs2/ops_fstype.c | 4 +---
 fs/gfs2/super.c  | 9 +++--
 fs/gfs2/super.h  | 2 +-
 fs/gfs2/util.c   | 2 +-
 4 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 74c7d01..aa41360 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1539,9 +1539,7 @@ static int gfs2_reconfigure(struct fs_context *fc)
return -EINVAL;
 
if (fc->sb_flags & SB_RDONLY) {
-   error = gfs2_make_fs_ro(sdp);
-   if (error)
-   errorfc(fc, "unable to remount read-only");
+   gfs2_make_fs_ro(sdp);
} else {
error = gfs2_make_fs_rw(sdp);
if (error)
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 861ed5f..6e2588f 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -587,9 +587,8 @@ static void gfs2_dirty_inode(struct inode *inode, int flags)
  * Returns: errno
  */
 
-int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
+void gfs2_make_fs_ro(struct gfs2_sbd *sdp)
 {
-   int error = 0;
int log_write_allowed = test_bit(SDF_JOURNAL_LIVE, >sd_flags);
 
gfs2_flush_delete_work(sdp);
@@ -625,7 +624,7 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
if (!log_write_allowed)
sdp->sd_vfs->s_flags |= SB_RDONLY;
 
-   return error;
+   return;
 }
 
 /**
@@ -658,9 +657,7 @@ static void gfs2_put_super(struct super_block *sb)
spin_unlock(>sd_jindex_spin);
 
if (!sb_rdonly(sb)) {
-   error = gfs2_make_fs_ro(sdp);
-   if (error)
-   gfs2_io_error(sdp);
+   gfs2_make_fs_ro(sdp);
}
WARN_ON(gfs2_withdrawing(sdp));
 
diff --git a/fs/gfs2/super.h b/fs/gfs2/super.h
index 08e502d..ec4affb3 100644
--- a/fs/gfs2/super.h
+++ b/fs/gfs2/super.h
@@ -34,7 +34,7 @@ extern int gfs2_lookup_in_master_dir(struct gfs2_sbd *sdp, 
char *filename,
 struct gfs2_inode **ipp);
 
 extern int gfs2_make_fs_rw(struct gfs2_sbd *sdp);
-extern int gfs2_make_fs_ro(struct gfs2_sbd *sdp);
+extern void gfs2_make_fs_ro(struct gfs2_sbd *sdp);
 extern void gfs2_online_uevent(struct gfs2_sbd *sdp);
 extern int gfs2_statfs_init(struct gfs2_sbd *sdp);
 extern void gfs2_statfs_change(struct gfs2_sbd *sdp, s64 total, s64 free,
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
index 8d3c670..5874331 100644
--- a/fs/gfs2/util.c
+++ b/fs/gfs2/util.c
@@ -156,7 +156,7 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp)
ret = 0;
}
if (!ret)
-   ret = gfs2_make_fs_ro(sdp);
+   gfs2_make_fs_ro(sdp);
gfs2_freeze_unlock(_gh);
}
 
-- 
1.8.3.1



[PATCH v2] ASoC: imx-hdmi: fix platform_no_drv_owner.cocci warnings

2021-03-04 Thread Yang Li
./sound/soc/fsl/imx-hdmi.c:226:3-8: No need to set .owner here. The core
will do it.

Remove .owner field if calls are used which set it automatically

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---

Change in v2:
-use imx-hdmi instead of hdmi-codec for Subject

 sound/soc/fsl/imx-hdmi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/fsl/imx-hdmi.c b/sound/soc/fsl/imx-hdmi.c
index dbbb761..cd0235a 100644
--- a/sound/soc/fsl/imx-hdmi.c
+++ b/sound/soc/fsl/imx-hdmi.c
@@ -223,7 +223,6 @@ static int imx_hdmi_probe(struct platform_device *pdev)
 static struct platform_driver imx_hdmi_driver = {
.driver = {
.name = "imx-hdmi",
-   .owner = THIS_MODULE,
.pm = _soc_pm_ops,
.of_match_table = imx_hdmi_dt_ids,
},
-- 
1.8.3.1



[PATCH] SoC: codecs: fix platform_no_drv_owner.cocci warnings

2021-03-03 Thread Yang Li
./sound/soc/codecs/lpass-rx-macro.c:3588:3-8: No need to set .owner here. 
The core will do it.

Remove .owner field if calls are used which set it automatically

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 sound/soc/codecs/lpass-rx-macro.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/codecs/lpass-rx-macro.c 
b/sound/soc/codecs/lpass-rx-macro.c
index c9c21d22..5b9d4e9 100644
--- a/sound/soc/codecs/lpass-rx-macro.c
+++ b/sound/soc/codecs/lpass-rx-macro.c
@@ -3585,7 +3585,6 @@ static int rx_macro_remove(struct platform_device *pdev)
 static struct platform_driver rx_macro_driver = {
.driver = {
.name = "rx_macro",
-   .owner = THIS_MODULE,
.of_match_table = rx_macro_dt_match,
.suppress_bind_attrs = true,
},
-- 
1.8.3.1



[PATCH] gfs2: Remove unneeded return variable

2021-03-02 Thread Yang Li
This patch removes unneeded return variables, using only
'0' instead.
It fixes the following warning detected by coccinelle:
./fs/gfs2/super.c:592:5-10: Unneeded variable: "error". Return "0" on
line 628

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 fs/gfs2/super.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 861ed5f..fe2dae4 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -589,7 +589,6 @@ static void gfs2_dirty_inode(struct inode *inode, int flags)
 
 int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
 {
-   int error = 0;
int log_write_allowed = test_bit(SDF_JOURNAL_LIVE, >sd_flags);
 
gfs2_flush_delete_work(sdp);
@@ -625,7 +624,7 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
if (!log_write_allowed)
sdp->sd_vfs->s_flags |= SB_RDONLY;
 
-   return error;
+   return 0;
 }
 
 /**
-- 
1.8.3.1



[PATCH] of: property: Remove unneeded return variable

2021-03-02 Thread Yang Li
This patch removes unneeded return variables, using only
'0' instead.
It fixes the following warning detected by coccinelle:
./drivers/of/property.c:1371:5-8: Unneeded variable: "ret". Return "0"
on line 1388

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/of/property.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/of/property.c b/drivers/of/property.c
index 5036a36..2381695 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1368,7 +1368,6 @@ static int of_link_property(struct device_node *con_np, 
const char *prop_name)
const struct supplier_bindings *s = of_supplier_bindings;
unsigned int i = 0;
bool matched = false;
-   int ret = 0;
 
/* Do not stop at first failed link, link all available suppliers. */
while (!matched && s->parse_prop) {
@@ -1385,7 +1384,7 @@ static int of_link_property(struct device_node *con_np, 
const char *prop_name)
}
s++;
}
-   return ret;
+   return 0;
 }
 
 static int of_fwnode_add_links(struct fwnode_handle *fwnode)
-- 
1.8.3.1



[PATCH v2] crypto: sun8i-ce: use kfree_sensitive() instead of

2021-03-02 Thread Yang Li
Use kfree_sensitive() instead of using kfree() to  make the intention 
of the API more explicit.

fixed the following coccicheck:
./drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c:30:16-17: WARNING
opportunity for kfree_sensitive/kvfree_sensitive (memset at line 29)
./drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c:42:16-17: WARNING
opportunity for kfree_sensitive/kvfree_sensitive (memset at line 41)
./drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c:161:8-9: WARNING
opportunity for kfree_sensitive/kvfree_sensitive (memset at line 109)

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
--

Changes in v2
-Change the appropriate title

 drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c 
b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
index cfde9ee..8259d52 100644
--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
@@ -27,7 +27,7 @@ void sun8i_ce_prng_exit(struct crypto_tfm *tfm)
struct sun8i_ce_rng_tfm_ctx *ctx = crypto_tfm_ctx(tfm);
 
memzero_explicit(ctx->seed, ctx->slen);
-   kfree(ctx->seed);
+   kfree_sensitive(ctx->seed);
ctx->seed = NULL;
ctx->slen = 0;
 }
@@ -39,7 +39,7 @@ int sun8i_ce_prng_seed(struct crypto_rng *tfm, const u8 *seed,
 
if (ctx->seed && ctx->slen != slen) {
memzero_explicit(ctx->seed, ctx->slen);
-   kfree(ctx->seed);
+   kfree_sensitive(ctx->seed);
ctx->slen = 0;
ctx->seed = NULL;
}
@@ -158,7 +158,7 @@ int sun8i_ce_prng_generate(struct crypto_rng *tfm, const u8 
*src,
}
memzero_explicit(d, todo);
 err_iv:
-   kfree(d);
+   kfree_sensitive(d);
 err_mem:
return err;
 }
-- 
1.8.3.1



[PATCH] coda: switch to vmemdup_user()

2021-03-02 Thread Yang Li
Replace opencoded alloc and copy with vmemdup_user()

fixed the following coccicheck:
./fs/coda/psdev.c:125:10-18: WARNING opportunity for vmemdup_user

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 fs/coda/psdev.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c
index 240669f..8d38e92 100644
--- a/fs/coda/psdev.c
+++ b/fs/coda/psdev.c
@@ -122,14 +122,9 @@ static ssize_t coda_psdev_write(struct file *file, const 
char __user *buf,
hdr.opcode, hdr.unique);
nbytes = size;
}
-   dcbuf = kvmalloc(nbytes, GFP_KERNEL);
-   if (!dcbuf) {
-   retval = -ENOMEM;
-   goto out;
-   }
-   if (copy_from_user(dcbuf, buf, nbytes)) {
-   kvfree(dcbuf);
-   retval = -EFAULT;
+   dcbuf = vmemdup_user(buf, nbytes)
+   if (IS_ERR(dcbuf)) {
+   r = PTR_ERR(dcbuf);
goto out;
}
 
-- 
1.8.3.1



[PATCH] btrfs: turn btrfs_destroy_all_ordered_extents() into void functions

2021-03-02 Thread Yang Li
These functions always return '0' and no callers use the return
value. So make it a void function.
It fixes the following warning detected by coccinelle:
./fs/btrfs/disk-io.c:4522:5-8: Unneeded variable: "ret". Return "0" on
line 4530

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 fs/btrfs/disk-io.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 41b718c..7c9e1b4 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -4513,13 +4513,12 @@ static void btrfs_destroy_all_ordered_extents(struct 
btrfs_fs_info *fs_info)
btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1);
 }
 
-static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
+static void btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
  struct btrfs_fs_info *fs_info)
 {
struct rb_node *node;
struct btrfs_delayed_ref_root *delayed_refs;
struct btrfs_delayed_ref_node *ref;
-   int ret = 0;
 
delayed_refs = >delayed_refs;
 
@@ -4527,7 +4526,7 @@ static int btrfs_destroy_delayed_refs(struct 
btrfs_transaction *trans,
if (atomic_read(_refs->num_entries) == 0) {
spin_unlock(_refs->lock);
btrfs_debug(fs_info, "delayed_refs has NO entry");
-   return ret;
+   return;
}
 
while ((node = rb_first_cached(_refs->href_root)) != NULL) {
@@ -4593,7 +4592,7 @@ static int btrfs_destroy_delayed_refs(struct 
btrfs_transaction *trans,
 
spin_unlock(_refs->lock);
 
-   return ret;
+   return;
 }
 
 static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root)
-- 
1.8.3.1



[PATCH] xattr: switch to vmemdup_user()

2021-03-02 Thread Yang Li
Replace opencoded alloc and copy with vmemdup_user()

fixed the following coccicheck:
./fs/xattr.c:561:11-19: WARNING opportunity for vmemdup_user

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 fs/xattr.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/xattr.c b/fs/xattr.c
index b3444e0..b947ad2 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -558,11 +558,10 @@ int __vfs_setxattr_noperm(struct user_namespace 
*mnt_userns,
if (size) {
if (size > XATTR_SIZE_MAX)
return -E2BIG;
-   kvalue = kvmalloc(size, GFP_KERNEL);
-   if (!kvalue)
-   return -ENOMEM;
-   if (copy_from_user(kvalue, value, size)) {
-   error = -EFAULT;
+   kvalue = vmemdup_user(value, size);
+
+   if (IS_ERR(kvalue)) {
+   r = PTR_ERR(kvalue);
goto out;
}
if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0) ||
-- 
1.8.3.1



[PATCH] crypto: sun8i-ce: rename kfree() to kfree_sensitive()

2021-03-01 Thread Yang Li
Rename kfree() to kfree_sensitive() to  make the intention of the API
more explicit.

fixed the following coccicheck:
./drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c:30:16-17: WARNING
opportunity for kfree_sensitive/kvfree_sensitive (memset at line 29)
./drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c:42:16-17: WARNING
opportunity for kfree_sensitive/kvfree_sensitive (memset at line 41)
./drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c:161:8-9: WARNING
opportunity for kfree_sensitive/kvfree_sensitive (memset at line 109)

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c 
b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
index cfde9ee..8259d52 100644
--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
@@ -27,7 +27,7 @@ void sun8i_ce_prng_exit(struct crypto_tfm *tfm)
struct sun8i_ce_rng_tfm_ctx *ctx = crypto_tfm_ctx(tfm);
 
memzero_explicit(ctx->seed, ctx->slen);
-   kfree(ctx->seed);
+   kfree_sensitive(ctx->seed);
ctx->seed = NULL;
ctx->slen = 0;
 }
@@ -39,7 +39,7 @@ int sun8i_ce_prng_seed(struct crypto_rng *tfm, const u8 *seed,
 
if (ctx->seed && ctx->slen != slen) {
memzero_explicit(ctx->seed, ctx->slen);
-   kfree(ctx->seed);
+   kfree_sensitive(ctx->seed);
ctx->slen = 0;
ctx->seed = NULL;
}
@@ -158,7 +158,7 @@ int sun8i_ce_prng_generate(struct crypto_rng *tfm, const u8 
*src,
}
memzero_explicit(d, todo);
 err_iv:
-   kfree(d);
+   kfree_sensitive(d);
 err_mem:
return err;
 }
-- 
1.8.3.1



[PATCH] driver core: Switch to using the new API kobj_to_dev()

2021-03-01 Thread Yang Li
fixed the following coccicheck:
./include/linux/device.h:590:46-47: WARNING opportunity for
kobj_to_dev()

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 include/linux/device.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index ba66073..31d7137 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -587,7 +587,7 @@ struct device_link {
 
 static inline struct device *kobj_to_dev(struct kobject *kobj)
 {
-   return container_of(kobj, struct device, kobj);
+   return kobj_to_dev(kobj);
 }
 
 /**
-- 
1.8.3.1



[PATCH] scsi: scsi_transport_spi: Switch to using the new API kobj_to_dev()

2021-03-01 Thread Yang Li
fixed the following coccicheck:
./drivers/scsi/scsi_transport_spi.c:1471:61-62: WARNING opportunity for
kobj_to_dev()

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/scsi/scsi_transport_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_transport_spi.c 
b/drivers/scsi/scsi_transport_spi.c
index c37dd15..6ea5635 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -1468,7 +1468,7 @@ static int spi_host_configure(struct transport_container 
*tc,
 static umode_t target_attribute_is_visible(struct kobject *kobj,
  struct attribute *attr, int i)
 {
-   struct device *cdev = container_of(kobj, struct device, kobj);
+   struct device *cdev = kobj_to_dev(kobj);
struct scsi_target *starget = transport_class_to_starget(cdev);
struct Scsi_Host *shost = transport_class_to_shost(cdev);
struct spi_internal *si = to_spi_internal(shost->transportt);
-- 
1.8.3.1



[PATCH] lightnvm: Switch to using the new API kobj_to_dev()

2021-03-01 Thread Yang Li
fixed the following coccicheck:
./drivers/nvme/host/lightnvm.c:1243:60-61: WARNING opportunity for
kobj_to_dev()

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/nvme/host/lightnvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index b705988..e3240d1 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -1240,7 +1240,7 @@ static ssize_t nvm_dev_attr_show_20(struct device *dev,
 static umode_t nvm_dev_attrs_visible(struct kobject *kobj,
 struct attribute *attr, int index)
 {
-   struct device *dev = container_of(kobj, struct device, kobj);
+   struct device *dev = kobj_to_dev(kobj);
struct gendisk *disk = dev_to_disk(dev);
struct nvme_ns *ns = disk->private_data;
struct nvm_dev *ndev = ns->ndev;
-- 
1.8.3.1



[PATCH] Input: cros_ec_keyb: Switch to using the new API kobj_to_dev()

2021-03-01 Thread Yang Li
fixed the following coccicheck:
./drivers/input/keyboard/cros_ec_keyb.c:647:60-61: WARNING opportunity
for kobj_to_dev()

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/input/keyboard/cros_ec_keyb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/cros_ec_keyb.c 
b/drivers/input/keyboard/cros_ec_keyb.c
index 38457d9..fc02c54 100644
--- a/drivers/input/keyboard/cros_ec_keyb.c
+++ b/drivers/input/keyboard/cros_ec_keyb.c
@@ -644,7 +644,7 @@ static umode_t cros_ec_keyb_attr_is_visible(struct kobject 
*kobj,
struct attribute *attr,
int n)
 {
-   struct device *dev = container_of(kobj, struct device, kobj);
+   struct device *dev = kobj_to_dev(kobj);
struct cros_ec_keyb *ckdev = dev_get_drvdata(dev);
 
if (attr == _attr_function_row_physmap.attr &&
-- 
1.8.3.1



[PATCH v2] regulator: add missing call to of_node_put()

2021-02-25 Thread Yang Li
In one of the error paths of the for_each_child_of_node() loop,
add missing call to of_node_put().

Fix the following coccicheck warning:
./drivers/regulator/scmi-regulator.c:343:1-23: WARNING: Function
"for_each_child_of_node" should have of_node_put() before return around
line 347.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---

Changes in v2:
-add braces for if

 drivers/regulator/scmi-regulator.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/scmi-regulator.c 
b/drivers/regulator/scmi-regulator.c
index 0e8b3ca..a917c81 100644
--- a/drivers/regulator/scmi-regulator.c
+++ b/drivers/regulator/scmi-regulator.c
@@ -343,8 +343,10 @@ static int scmi_regulator_probe(struct scmi_device *sdev)
for_each_child_of_node(np, child) {
ret = process_scmi_regulator_of_node(sdev, child, rinfo);
/* abort on any mem issue */
-   if (ret == -ENOMEM)
+   if (ret == -ENOMEM) {
+   of_node_put(child);
return ret;
+   }
}
 
/*
-- 
1.8.3.1



[PATCH v2] pinctrl: ingenic: add missing call to of_node_put()

2021-02-25 Thread Yang Li
In one of the error paths of the for_each_child_of_node() loop in
ingenic_gpio_probe, add missing call to of_node_put().

Fix the following coccicheck warning:
./drivers/pinctrl/pinctrl-ingenic.c:2485:1-23: WARNING: Function
"for_each_child_of_node" should have of_node_put() before return around
line 2489.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---

Changes in v2:
-add braces for if

 drivers/pinctrl/pinctrl-ingenic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-ingenic.c 
b/drivers/pinctrl/pinctrl-ingenic.c
index f274612..c8ecd01 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -2485,8 +2485,10 @@ static int __init ingenic_pinctrl_probe(struct 
platform_device *pdev)
for_each_child_of_node(dev->of_node, node) {
if (of_match_node(ingenic_gpio_of_match, node)) {
err = ingenic_gpio_probe(jzpc, node);
-   if (err)
+   if (err) {
+   of_node_put(node);
return err;
+   }
}
}
 
-- 
1.8.3.1



[PATCH v2] media: exynos4-is: add missing call to of_node_put()

2021-02-25 Thread Yang Li
In one of the error paths of the for_each_child_of_node() loop in
fimc_md_parse_one_endpoint, add missing call to of_node_put().

Fix the following coccicheck warning:
./drivers/media/platform/exynos4-is/media-dev.c:489:1-23: WARNING:
Function "for_each_child_of_node" should have of_node_put() before
return around line 492.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---

Changes in v2:
-add braces for if

 drivers/media/platform/exynos4-is/media-dev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/exynos4-is/media-dev.c 
b/drivers/media/platform/exynos4-is/media-dev.c
index 8e1e892..a6ee2a3 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -488,8 +488,10 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
 
for_each_child_of_node(port, ep) {
ret = fimc_md_parse_one_endpoint(fmd, ep);
-   if (ret < 0)
+   if (ret < 0) {
+   of_node_put(ep);
return ret;
+   }
}
 
return 0;
-- 
1.8.3.1



[PATCH v2] crypto/nx: add missing call to of_node_put()

2021-02-25 Thread Yang Li
In one of the error paths of the for_each_child_of_node() loop,
add missing call to of_node_put().

Fix the following coccicheck warning:
./drivers/crypto/nx/nx-common-powernv.c:927:1-23: WARNING: Function
"for_each_child_of_node" should have of_node_put() before return around
line 936.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---

Changes in v2:
-add braces for if

 drivers/crypto/nx/nx-common-powernv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/nx/nx-common-powernv.c 
b/drivers/crypto/nx/nx-common-powernv.c
index 13c65de..446f611 100644
--- a/drivers/crypto/nx/nx-common-powernv.c
+++ b/drivers/crypto/nx/nx-common-powernv.c
@@ -932,8 +932,10 @@ static int __init nx_powernv_probe_vas(struct device_node 
*pn)
ret = find_nx_device_tree(dn, chip_id, vasid,
NX_CT_GZIP, "ibm,p9-nx-gzip", _gzip);
 
-   if (ret)
+   if (ret) {
+   of_node_put(dn);
return ret;
+   }
}
 
if (!ct_842 || !ct_gzip) {
-- 
1.8.3.1



[PATCH] phy: ti: j721e-wiz: add missing call to of_node_put()

2021-02-25 Thread Yang Li
In one of the error paths of the for_each_child_of_node() loop in
of_property_read_u32, add missing call to of_node_put().

Fix the following coccicheck warning:
./drivers/phy/ti/phy-j721e-wiz.c:786:1-23: WARNING: Function
"for_each_child_of_node" should have of_node_put() before return around
line 795.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/phy/ti/phy-j721e-wiz.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c
index c9cfafe..448d8d1 100644
--- a/drivers/phy/ti/phy-j721e-wiz.c
+++ b/drivers/phy/ti/phy-j721e-wiz.c
@@ -789,6 +789,7 @@ static int wiz_get_lane_phy_types(struct device *dev, 
struct wiz *wiz)
 
ret = of_property_read_u32(subnode, "reg", );
if (ret) {
+   of_node_put(subnode);
dev_err(dev,
"%s: Reading \"reg\" from \"%s\" failed: %d\n",
__func__, subnode->name, ret);
-- 
1.8.3.1



[PATCH] pinctrl: ingenic: add missing call to of_node_put()

2021-02-25 Thread Yang Li
In one of the error paths of the for_each_child_of_node() loop in
ingenic_gpio_probe, add missing call to of_node_put().

Fix the following coccicheck warning:
./drivers/pinctrl/pinctrl-ingenic.c:2485:1-23: WARNING: Function
"for_each_child_of_node" should have of_node_put() before return around
line 2489.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/pinctrl/pinctrl-ingenic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/pinctrl-ingenic.c 
b/drivers/pinctrl/pinctrl-ingenic.c
index f274612..b7294a2 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -2486,6 +2486,7 @@ static int __init ingenic_pinctrl_probe(struct 
platform_device *pdev)
if (of_match_node(ingenic_gpio_of_match, node)) {
err = ingenic_gpio_probe(jzpc, node);
if (err)
+   of_node_put(node);
return err;
}
}
-- 
1.8.3.1



[PATCH] powerpc: Replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE

2021-02-25 Thread Yang Li
Fix the following coccicheck warning:
./arch/powerpc/kernel/setup_64.c:1143:0-23: WARNING: fops_rfi_flush
should be defined with DEFINE_DEBUGFS_ATTRIBUTE
./arch/powerpc/kernel/setup_64.c:1169:0-23: WARNING: fops_entry_flush
should be defined with DEFINE_DEBUGFS_ATTRIBUTE
./arch/powerpc/kernel/setup_64.c:1195:0-23: WARNING: fops_uaccess_flush
should be defined with DEFINE_DEBUGFS_ATTRIBUTE
./arch/powerpc/platforms/powernv/memtrace.c:311:0-23: WARNING:
memtrace_init_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE
./arch/powerpc/xmon/xmon.c:3997:0-23: WARNING: xmon_dbgfs_ops should be
defined with DEFINE_DEBUGFS_ATTRIBUTE

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/powerpc/kernel/setup_64.c| 6 +++---
 arch/powerpc/platforms/powernv/memtrace.c | 4 ++--
 arch/powerpc/xmon/xmon.c  | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 560ed8b..6a030b0 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -1140,7 +1140,7 @@ static int rfi_flush_get(void *data, u64 *val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_rfi_flush, rfi_flush_get, rfi_flush_set, 
"%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_rfi_flush, rfi_flush_get, rfi_flush_set, 
"%llu\n");
 
 static int entry_flush_set(void *data, u64 val)
 {
@@ -1166,7 +1166,7 @@ static int entry_flush_get(void *data, u64 *val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_entry_flush, entry_flush_get, entry_flush_set, 
"%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_entry_flush, entry_flush_get, entry_flush_set, 
"%llu\n");
 
 static int uaccess_flush_set(void *data, u64 val)
 {
@@ -1192,7 +1192,7 @@ static int uaccess_flush_get(void *data, u64 *val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_uaccess_flush, uaccess_flush_get, 
uaccess_flush_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_uaccess_flush, uaccess_flush_get, 
uaccess_flush_set, "%llu\n");
 
 static __init int rfi_flush_debugfs_init(void)
 {
diff --git a/arch/powerpc/platforms/powernv/memtrace.c 
b/arch/powerpc/platforms/powernv/memtrace.c
index 019669e..731be02 100644
--- a/arch/powerpc/platforms/powernv/memtrace.c
+++ b/arch/powerpc/platforms/powernv/memtrace.c
@@ -308,8 +308,8 @@ static int memtrace_enable_get(void *data, u64 *val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(memtrace_init_fops, memtrace_enable_get,
-   memtrace_enable_set, "0x%016llx\n");
+DEFINE_DEBUGFS_ATTRIBUTE(memtrace_init_fops, memtrace_enable_get,
+memtrace_enable_set, "0x%016llx\n");
 
 static int memtrace_init(void)
 {
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 3fe3749..6d54767 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -3994,7 +3994,7 @@ static int xmon_dbgfs_get(void *data, u64 *val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(xmon_dbgfs_ops, xmon_dbgfs_get,
+DEFINE_DEBUGFS_ATTRIBUTE(xmon_dbgfs_ops, xmon_dbgfs_get,
xmon_dbgfs_set, "%llu\n");
 
 static int __init setup_xmon_dbgfs(void)
-- 
1.8.3.1



[PATCH] regulator: add missing call to of_node_put()

2021-02-25 Thread Yang Li
In one of the error paths of the for_each_child_of_node() loop,
add missing call to of_node_put().

Fix the following coccicheck warning:
./drivers/regulator/scmi-regulator.c:343:1-23: WARNING: Function
"for_each_child_of_node" should have of_node_put() before return around
line 347.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/regulator/scmi-regulator.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/regulator/scmi-regulator.c 
b/drivers/regulator/scmi-regulator.c
index 0e8b3ca..a41bb06 100644
--- a/drivers/regulator/scmi-regulator.c
+++ b/drivers/regulator/scmi-regulator.c
@@ -344,6 +344,7 @@ static int scmi_regulator_probe(struct scmi_device *sdev)
ret = process_scmi_regulator_of_node(sdev, child, rinfo);
/* abort on any mem issue */
if (ret == -ENOMEM)
+   of_node_put(child);
return ret;
}
 
-- 
1.8.3.1



[PATCH] memory: tegra: Replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE

2021-02-25 Thread Yang Li
Fix the following coccicheck warning:
./drivers/memory/tegra/tegra124-emc.c:1207:0-23: WARNING:
tegra_emc_debug_min_rate_fops should be defined with
DEFINE_DEBUGFS_ATTRIBUTE
./drivers/memory/tegra/tegra124-emc.c:1237:0-23: WARNING:
tegra_emc_debug_max_rate_fops should be defined with
DEFINE_DEBUGFS_ATTRIBUTE

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/memory/tegra/tegra124-emc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/tegra/tegra124-emc.c 
b/drivers/memory/tegra/tegra124-emc.c
index bee8d9f..874e1a0 100644
--- a/drivers/memory/tegra/tegra124-emc.c
+++ b/drivers/memory/tegra/tegra124-emc.c
@@ -1204,7 +1204,7 @@ static int tegra_emc_debug_min_rate_set(void *data, u64 
rate)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(tegra_emc_debug_min_rate_fops,
+DEFINE_DEBUGFS_ATTRIBUTE(tegra_emc_debug_min_rate_fops,
tegra_emc_debug_min_rate_get,
tegra_emc_debug_min_rate_set, "%llu\n");
 
@@ -1234,7 +1234,7 @@ static int tegra_emc_debug_max_rate_set(void *data, u64 
rate)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(tegra_emc_debug_max_rate_fops,
+DEFINE_DEBUGFS_ATTRIBUTE(tegra_emc_debug_max_rate_fops,
tegra_emc_debug_max_rate_get,
tegra_emc_debug_max_rate_set, "%llu\n");
 
-- 
1.8.3.1



[PATCH] media: exynos4-is: add missing call to of_node_put()

2021-02-25 Thread Yang Li
In one of the error paths of the for_each_child_of_node() loop in
fimc_md_parse_one_endpoint, add missing call to of_node_put().

Fix the following coccicheck warning:
./drivers/media/platform/exynos4-is/media-dev.c:489:1-23: WARNING:
Function "for_each_child_of_node" should have of_node_put() before
return around line 492.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/media/platform/exynos4-is/media-dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/exynos4-is/media-dev.c 
b/drivers/media/platform/exynos4-is/media-dev.c
index 8e1e892..467bc69 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -489,6 +489,7 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
for_each_child_of_node(port, ep) {
ret = fimc_md_parse_one_endpoint(fmd, ep);
if (ret < 0)
+   of_node_put(ep);
return ret;
}
 
-- 
1.8.3.1



[PATCH] drm/amdgpu: Replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE

2021-02-25 Thread Yang Li
Fix the following coccicheck warning:
./drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1589:0-23: WARNING:
fops_ib_preempt should be defined with DEFINE_DEBUGFS_ATTRIBUTE
./drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1592:0-23: WARNING:
fops_sclk_set should be defined with DEFINE_DEBUGFS_ATTRIBUTE

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 0a25fec..52ef488 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1586,10 +1586,10 @@ static int amdgpu_debugfs_sclk_set(void *data, u64 val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,
+DEFINE_DEBUGFS_ATTRIBUTE(fops_ib_preempt, NULL,
amdgpu_debugfs_ib_preempt, "%llu\n");
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_sclk_set, NULL,
+DEFINE_DEBUGFS_ATTRIBUTE(fops_sclk_set, NULL,
amdgpu_debugfs_sclk_set, "%llu\n");
 
 int amdgpu_debugfs_init(struct amdgpu_device *adev)
-- 
1.8.3.1



[PATCH] direct-io: Using kmem_cache_zalloc() instead of kmem_cache_alloc() and memset()

2021-02-25 Thread Yang Li
Fix the following coccicheck warning:
./fs/direct-io.c:1155:7-23: WARNING: kmem_cache_zalloc should be used
for dio, instead of kmem_cache_alloc/memset

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 fs/direct-io.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index 0957e1b..6ec2935 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1152,7 +1152,7 @@ static inline int drop_refcount(struct dio *dio)
if (iov_iter_rw(iter) == READ && !count)
return 0;
 
-   dio = kmem_cache_alloc(dio_cache, GFP_KERNEL);
+   dio = kmem_cache_zalloc(dio_cache, GFP_KERNEL);
if (!dio)
return -ENOMEM;
/*
@@ -1160,8 +1160,6 @@ static inline int drop_refcount(struct dio *dio)
 * performance regression in a database benchmark.  So, we take
 * care to only zero out what's needed.
 */
-   memset(dio, 0, offsetof(struct dio, pages));
-
dio->flags = flags;
if (dio->flags & DIO_LOCKING && iov_iter_rw(iter) == READ) {
/* will be released by direct_io_worker */
-- 
1.8.3.1



[PATCH] crypto/nx: add missing call to of_node_put()

2021-02-25 Thread Yang Li
In one of the error paths of the for_each_child_of_node() loop,
add missing call to of_node_put().

Fix the following coccicheck warning:
./drivers/crypto/nx/nx-common-powernv.c:927:1-23: WARNING: Function
"for_each_child_of_node" should have of_node_put() before return around
line 936.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/crypto/nx/nx-common-powernv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/nx/nx-common-powernv.c 
b/drivers/crypto/nx/nx-common-powernv.c
index 13c65de..b43c457 100644
--- a/drivers/crypto/nx/nx-common-powernv.c
+++ b/drivers/crypto/nx/nx-common-powernv.c
@@ -933,6 +933,7 @@ static int __init nx_powernv_probe_vas(struct device_node 
*pn)
NX_CT_GZIP, "ibm,p9-nx-gzip", _gzip);
 
if (ret)
+   of_node_put(dn);
return ret;
}
 
-- 
1.8.3.1



[PATCH] ARM: OMAP2+: add missing call to of_node_put()

2021-02-25 Thread Yang Li
In one of the error paths of the for_each_child_of_node() loop,
add missing call to of_node_put().

Fix the following coccicheck warning:
./arch/arm/mach-omap2/omap_hwmod.c:2132:1-23: WARNING: Function
"for_each_child_of_node" should have of_node_put() before return around
line 2140.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 arch/arm/mach-omap2/omap_hwmod.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 2310cd5..007e91e 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2137,6 +2137,7 @@ static int of_dev_hwmod_lookup(struct device_node *np,
if (res == 0) {
*found = fc;
*index = i;
+   of_node_put(np0);
return 0;
}
}
-- 
1.8.3.1



[PATCH] PM: AVS: Replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE

2021-02-24 Thread Yang Li
Fix the following coccicheck warning:
./drivers/soc/ti/smartreflex.c:820:0-23: WARNING: pm_sr_fops should be
defined with DEFINE_DEBUGFS_ATTRIBUTE

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/soc/ti/smartreflex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/ti/smartreflex.c b/drivers/soc/ti/smartreflex.c
index 5376f3d..b3c7460 100644
--- a/drivers/soc/ti/smartreflex.c
+++ b/drivers/soc/ti/smartreflex.c
@@ -817,7 +817,7 @@ static int omap_sr_autocomp_store(void *data, u64 val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(pm_sr_fops, omap_sr_autocomp_show,
+DEFINE_DEBUGFS_ATTRIBUTE(pm_sr_fops, omap_sr_autocomp_show,
omap_sr_autocomp_store, "%llu\n");
 
 static int omap_sr_probe(struct platform_device *pdev)
-- 
1.8.3.1



[PATCH] Input: edt-ft5x06: Replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE

2021-02-24 Thread Yang Li
Fix the following coccicheck warning:
./drivers/input/touchscreen/edt-ft5x06.c:697:0-23: WARNING:
debugfs_mode_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/input/touchscreen/edt-ft5x06.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/edt-ft5x06.c 
b/drivers/input/touchscreen/edt-ft5x06.c
index 2eefbc2..12bbc58 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -694,7 +694,7 @@ static int edt_ft5x06_debugfs_mode_set(void *data, u64 mode)
return retval;
 };
 
-DEFINE_SIMPLE_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get,
+DEFINE_DEBUGFS_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get,
edt_ft5x06_debugfs_mode_set, "%llu\n");
 
 static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file,
-- 
1.8.3.1



  1   2   3   >