[tip: x86/sgx] x86/sgx: Mark sgx_vepc_vm_ops static

2021-04-12 Thread tip-bot2 for Wei Yongjun
The following commit has been merged into the x86/sgx branch of tip:

Commit-ID: 523caed9efbb049339706b124185c9358c1b6477
Gitweb:
https://git.kernel.org/tip/523caed9efbb049339706b124185c9358c1b6477
Author:Wei Yongjun 
AuthorDate:Mon, 12 Apr 2021 16:00:23 
Committer: Borislav Petkov 
CommitterDate: Mon, 12 Apr 2021 19:48:32 +02:00

x86/sgx: Mark sgx_vepc_vm_ops static

Fix the following sparse warning:

  arch/x86/kernel/cpu/sgx/virt.c:95:35: warning:
symbol 'sgx_vepc_vm_ops' was not declared. Should it be static?

This symbol is not used outside of virt.c so mark it static.

 [ bp: Massage commit message. ]

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
Signed-off-by: Borislav Petkov 
Link: https://lkml.kernel.org/r/20210412160023.193850-1-weiyongj...@huawei.com
---
 arch/x86/kernel/cpu/sgx/virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/sgx/virt.c b/arch/x86/kernel/cpu/sgx/virt.c
index 7d221ea..6ad165a 100644
--- a/arch/x86/kernel/cpu/sgx/virt.c
+++ b/arch/x86/kernel/cpu/sgx/virt.c
@@ -92,7 +92,7 @@ static vm_fault_t sgx_vepc_fault(struct vm_fault *vmf)
return VM_FAULT_SIGBUS;
 }
 
-const struct vm_operations_struct sgx_vepc_vm_ops = {
+static const struct vm_operations_struct sgx_vepc_vm_ops = {
.fault = sgx_vepc_fault,
 };
 


[tip: timers/core] clocksource/drivers/ingenic_ost: Fix return value check in ingenic_ost_probe()

2021-04-09 Thread tip-bot2 for Wei Yongjun
The following commit has been merged into the timers/core branch of tip:

Commit-ID: 2a65f7e2772613debd03fa2492e76a635aa04545
Gitweb:
https://git.kernel.org/tip/2a65f7e2772613debd03fa2492e76a635aa04545
Author:Wei Yongjun 
AuthorDate:Mon, 08 Mar 2021 12:30:31 
Committer: Daniel Lezcano 
CommitterDate: Thu, 08 Apr 2021 13:24:15 +02:00

clocksource/drivers/ingenic_ost: Fix return value check in ingenic_ost_probe()

In case of error, the function device_node_to_regmap() returns
ERR_PTR() and never returns NULL. The NULL test in the return
value check should be replaced with IS_ERR().

Fixes: ca7b72b5a5f2 ("clocksource: Add driver for the Ingenic JZ47xx OST")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
Signed-off-by: Daniel Lezcano 
Link: https://lore.kernel.org/r/20210308123031.2285083-1-weiyongj...@huawei.com
---
 drivers/clocksource/ingenic-ost.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/ingenic-ost.c 
b/drivers/clocksource/ingenic-ost.c
index d2d6646..06d2575 100644
--- a/drivers/clocksource/ingenic-ost.c
+++ b/drivers/clocksource/ingenic-ost.c
@@ -88,9 +88,9 @@ static int __init ingenic_ost_probe(struct platform_device 
*pdev)
return PTR_ERR(ost->regs);
 
map = device_node_to_regmap(dev->parent->of_node);
-   if (!map) {
+   if (IS_ERR(map)) {
dev_err(dev, "regmap not found");
-   return -EINVAL;
+   return PTR_ERR(map);
}
 
ost->clk = devm_clk_get(dev, "ost");


[PATCH -next v2] coresight: trbe: Fix return value check in arm_trbe_register_coresight_cpu()

2021-04-09 Thread Wei Yongjun
In case of error, the function devm_kasprintf() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value
check should be replaced with NULL test.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
v1 -> v2: remove fixes tag.
---
 drivers/hwtracing/coresight/coresight-trbe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-trbe.c 
b/drivers/hwtracing/coresight/coresight-trbe.c
index 5ce239875c98..176868496879 100644
--- a/drivers/hwtracing/coresight/coresight-trbe.c
+++ b/drivers/hwtracing/coresight/coresight-trbe.c
@@ -871,7 +871,7 @@ static void arm_trbe_register_coresight_cpu(struct 
trbe_drvdata *drvdata, int cp
 
dev = >drvdata->pdev->dev;
desc.name = devm_kasprintf(dev, GFP_KERNEL, "trbe%d", cpu);
-   if (IS_ERR(desc.name))
+   if (!desc.name)
goto cpu_clear;
 
desc.type = CORESIGHT_DEV_TYPE_SINK;



[PATCH -next v2] coresight: core: Make symbol 'csdev_sink' static

2021-04-09 Thread Wei Yongjun
The sparse tool complains as follows:

drivers/hwtracing/coresight/coresight-core.c:26:1: warning:
 symbol '__pcpu_scope_csdev_sink' was not declared. Should it be static?

As csdev_sink is not used outside of coresight-core.c after the
introduction of coresight_[set|get]_percpu_sink() helpers, this
change marks it static.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
v1 -> v2: remove fixes tag and description.
---
 drivers/hwtracing/coresight/coresight-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-core.c 
b/drivers/hwtracing/coresight/coresight-core.c
index 3e779e1619ed..6c68d34d956e 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -23,7 +23,7 @@
 #include "coresight-priv.h"
 
 static DEFINE_MUTEX(coresight_mutex);
-DEFINE_PER_CPU(struct coresight_device *, csdev_sink);
+static DEFINE_PER_CPU(struct coresight_device *, csdev_sink);
 
 /**
  * struct coresight_node - elements of a path, from source to sink



[PATCH -next] gfs2: use kmem_cache_free() instead of kfree()

2021-04-09 Thread Wei Yongjun
memory allocated by kmem_cache_alloc() should be freed using
kmem_cache_free(), not kfree().

Fixes: 7d6eec37a105 ("gfs2: Allocate bufdata object before taking log lock")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 fs/gfs2/trans.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index c50de22d7cbf..1b47d08ac4fb 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -206,7 +206,7 @@ void gfs2_trans_add_data(struct gfs2_glock *gl, struct 
buffer_head *bh)
}
gfs2_log_lock(sdp);
if (bh->b_private) {
-   kfree(bd);
+   kmem_cache_free(gfs2_bufdata_cachep, bd);
bd = bh->b_private;
} else {
bh->b_private = bd;
@@ -246,12 +246,12 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct 
buffer_head *bh)
}
gfs2_log_lock(sdp);
if (bh->b_private) {
-   kfree(bd);
+   kmem_cache_free(gfs2_bufdata_cachep, bd);
bd = bh->b_private;
} else {
lock_page(bh->b_page);
if (bh->b_private) {
-   kfree(bd);
+   kmem_cache_free(gfs2_bufdata_cachep, bd);
bd = bh->b_private;
} else {
bh->b_private = bd;



[PATCH -next] coresight: core: Make symbol 'csdev_sink' static

2021-04-08 Thread Wei Yongjun
The sparse tool complains as follows:

drivers/hwtracing/coresight/coresight-core.c:26:1: warning:
 symbol '__pcpu_scope_csdev_sink' was not declared. Should it be static?

This symbol is not used outside of coresight-core.c, so this
commit marks it static.

Fixes: 2cd87a7b293d ("coresight: core: Add support for dedicated percpu sinks")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/hwtracing/coresight/coresight-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-core.c 
b/drivers/hwtracing/coresight/coresight-core.c
index 3e779e1619ed..6c68d34d956e 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -23,7 +23,7 @@
 #include "coresight-priv.h"
 
 static DEFINE_MUTEX(coresight_mutex);
-DEFINE_PER_CPU(struct coresight_device *, csdev_sink);
+static DEFINE_PER_CPU(struct coresight_device *, csdev_sink);
 
 /**
  * struct coresight_node - elements of a path, from source to sink



[PATCH -next] coresight: trbe: Fix return value check in arm_trbe_register_coresight_cpu()

2021-04-08 Thread Wei Yongjun
In case of error, the function devm_kasprintf() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value
check should be replaced with NULL test.

Fixes: 3fbf7f011f24 ("coresight: sink: Add TRBE driver")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/hwtracing/coresight/coresight-trbe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-trbe.c 
b/drivers/hwtracing/coresight/coresight-trbe.c
index 5ce239875c98..176868496879 100644
--- a/drivers/hwtracing/coresight/coresight-trbe.c
+++ b/drivers/hwtracing/coresight/coresight-trbe.c
@@ -871,7 +871,7 @@ static void arm_trbe_register_coresight_cpu(struct 
trbe_drvdata *drvdata, int cp
 
dev = >drvdata->pdev->dev;
desc.name = devm_kasprintf(dev, GFP_KERNEL, "trbe%d", cpu);
-   if (IS_ERR(desc.name))
+   if (!desc.name)
goto cpu_clear;
 
desc.type = CORESIGHT_DEV_TYPE_SINK;



[tip: x86/core] x86/kprobes: Move 'inline' to the beginning of the kprobe_is_ss() declaration

2021-03-25 Thread tip-bot2 for Wei Yongjun
The following commit has been merged into the x86/core branch of tip:

Commit-ID: 2304d14db6595bea5292bece06c4c625b12d8f89
Gitweb:
https://git.kernel.org/tip/2304d14db6595bea5292bece06c4c625b12d8f89
Author:Wei Yongjun 
AuthorDate:Wed, 24 Mar 2021 14:45:02 
Committer: Ingo Molnar 
CommitterDate: Thu, 25 Mar 2021 13:07:58 +01:00

x86/kprobes: Move 'inline' to the beginning of the kprobe_is_ss() declaration

Address this GCC warning:

  arch/x86/kernel/kprobes/core.c:940:1:
   warning: 'inline' is not at beginning of declaration 
[-Wold-style-declaration]
940 | static int nokprobe_inline kprobe_is_ss(struct kprobe_ctlblk *kcb)
| ^~

[ mingo: Tidied up the changelog. ]

Fixes: 6256e668b7af: ("x86/kprobes: Use int3 instead of debug trap for 
single-step")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
Signed-off-by: Ingo Molnar 
Acked-by: Masami Hiramatsu 
Link: https://lore.kernel.org/r/20210324144502.1154883-1-weiyongj...@huawei.com
---
 arch/x86/kernel/kprobes/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 922a6e2..dd09021 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -940,7 +940,7 @@ static int reenter_kprobe(struct kprobe *p, struct pt_regs 
*regs,
 }
 NOKPROBE_SYMBOL(reenter_kprobe);
 
-static int nokprobe_inline kprobe_is_ss(struct kprobe_ctlblk *kcb)
+static nokprobe_inline int kprobe_is_ss(struct kprobe_ctlblk *kcb)
 {
return (kcb->kprobe_status == KPROBE_HIT_SS ||
kcb->kprobe_status == KPROBE_REENTER);


[PATCH -next] x86/kprobes: Fix old-style-declaration warning

2021-03-24 Thread 'Wei Yongjun
From: Wei Yongjun 

Gcc reports build warning as follows:

arch/x86/kernel/kprobes/core.c:940:1:
 warning: 'inline' is not at beginning of declaration [-Wold-style-declaration]
  940 | static int nokprobe_inline kprobe_is_ss(struct kprobe_ctlblk *kcb)
  | ^~

This commit fix it by moving nokprobe_inline to the beginning
of declaration.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 arch/x86/kernel/kprobes/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 89d9f26785c7..5abf251f12ec 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -937,7 +937,7 @@ static int reenter_kprobe(struct kprobe *p, struct pt_regs 
*regs,
 }
 NOKPROBE_SYMBOL(reenter_kprobe);
 
-static int nokprobe_inline kprobe_is_ss(struct kprobe_ctlblk *kcb)
+static nokprobe_inline int kprobe_is_ss(struct kprobe_ctlblk *kcb)
 {
return (kcb->kprobe_status == KPROBE_HIT_SS ||
kcb->kprobe_status == KPROBE_REENTER);



[PATCH -next] libnvdimm/security: Make symbol '__nvdimm_security_overwrite_query' static

2021-03-24 Thread 'Wei Yongjun
From: Wei Yongjun 

The sparse tool complains as follows:

drivers/nvdimm/security.c:416:6: warning:
 symbol '__nvdimm_security_overwrite_query' was not declared. Should it be 
static?

This symbol is not used outside of security.c, so this
commit marks it static.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/nvdimm/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvdimm/security.c b/drivers/nvdimm/security.c
index 4b80150e4afa..d3e782662bf4 100644
--- a/drivers/nvdimm/security.c
+++ b/drivers/nvdimm/security.c
@@ -413,7 +413,7 @@ static int security_overwrite(struct nvdimm *nvdimm, 
unsigned int keyid)
return rc;
 }
 
-void __nvdimm_security_overwrite_query(struct nvdimm *nvdimm)
+static void __nvdimm_security_overwrite_query(struct nvdimm *nvdimm)
 {
struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(>dev);
int rc;



[PATCH -next] perf/arm_dmc620_pmu: Fix error return code in dmc620_pmu_device_probe()

2021-03-11 Thread 'Wei Yongjun
From: Wei Yongjun 

Fix to return negative error code -ENOMEM from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 53c218da220c ("driver/perf: Add PMU driver for the ARM DMC-620 memory 
controller")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/perf/arm_dmc620_pmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c
index 66ad5b3ece19..f2a85500258d 100644
--- a/drivers/perf/arm_dmc620_pmu.c
+++ b/drivers/perf/arm_dmc620_pmu.c
@@ -681,6 +681,7 @@ static int dmc620_pmu_device_probe(struct platform_device 
*pdev)
if (!name) {
dev_err(>dev,
  "Create name failed, PMU @%pa\n", >start);
+   ret = -ENOMEM;
goto out_teardown_dev;
}
 



[PATCH -next] mfd: Make symbol 'atc260x_i2c_of_match' static

2021-03-11 Thread 'Wei Yongjun
From: Wei Yongjun 

The sparse tool complains as follows:

drivers/mfd/atc260x-i2c.c:45:27: warning:
 symbol 'atc260x_i2c_of_match' was not declared. Should it be static?

This symbol is not used outside of atc260x-i2c.c, so this
commit marks it static.

Fixes: f7cb7fe34db9 ("mfd: Add MFD driver for ATC260x PMICs")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/mfd/atc260x-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/atc260x-i2c.c b/drivers/mfd/atc260x-i2c.c
index 362005703367..5855efd09efc 100644
--- a/drivers/mfd/atc260x-i2c.c
+++ b/drivers/mfd/atc260x-i2c.c
@@ -42,7 +42,7 @@ static int atc260x_i2c_probe(struct i2c_client *client,
return atc260x_device_probe(atc260x);
 }
 
-const struct of_device_id atc260x_i2c_of_match[] = {
+static const struct of_device_id atc260x_i2c_of_match[] = {
{ .compatible = "actions,atc2603c", .data = (void *)ATC2603C },
{ .compatible = "actions,atc2609a", .data = (void *)ATC2609A },
{ }



[PATCH -next] ASoC: rt715-sdca: Fix return value check in rt715_sdca_sdw_probe()

2021-03-09 Thread 'Wei Yongjun
From: Wei Yongjun 

In case of error, the function devm_regmap_init_sdw_mbq() and
devm_regmap_init_sdw() returns ERR_PTR() not NULL. The NULL test
in the return value check should be replaced with IS_ERR().

Fixes: 393c52d2d109 ("ASoC: rt715-sdca: Add RT715 sdca vendor-specific driver")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 sound/soc/codecs/rt715-sdca-sdw.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/rt715-sdca-sdw.c 
b/sound/soc/codecs/rt715-sdca-sdw.c
index bcced85876b0..1350798406f0 100644
--- a/sound/soc/codecs/rt715-sdca-sdw.c
+++ b/sound/soc/codecs/rt715-sdca-sdw.c
@@ -184,12 +184,12 @@ static int rt715_sdca_sdw_probe(struct sdw_slave *slave,
 
/* Regmap Initialization */
mbq_regmap = devm_regmap_init_sdw_mbq(slave, _sdca_mbq_regmap);
-   if (!mbq_regmap)
-   return -EINVAL;
+   if (IS_ERR(mbq_regmap))
+   return PTR_ERR(mbq_regmap);
 
regmap = devm_regmap_init_sdw(slave, _sdca_regmap);
-   if (!regmap)
-   return -EINVAL;
+   if (IS_ERR(regmap))
+   return PTR_ERR(regmap);
 
return rt715_sdca_init(>dev, mbq_regmap, regmap, slave);
 }



[PATCH -next] ASoC: rt715-sdca: Remove unused including

2021-03-09 Thread 'Wei Yongjun
From: Wei Yongjun 

Remove including  that don't need it.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 sound/soc/codecs/rt715-sdca.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/codecs/rt715-sdca.c b/sound/soc/codecs/rt715-sdca.c
index 92ad6fa408ec..20528afbdc57 100644
--- a/sound/soc/codecs/rt715-sdca.c
+++ b/sound/soc/codecs/rt715-sdca.c
@@ -9,7 +9,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



[PATCH -next] coresight: etm: perf: Make symbol 'format_attr_contextid' static

2021-03-08 Thread 'Wei Yongjun
From: Wei Yongjun 

The sparse tool complains as follows:

drivers/hwtracing/coresight/coresight-etm-perf.c:61:25: warning:
 symbol 'format_attr_contextid' was not declared. Should it be static?

This symbol is not used outside of coresight-etm-perf.c, so this
commit marks it static.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/hwtracing/coresight/coresight-etm-perf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c 
b/drivers/hwtracing/coresight/coresight-etm-perf.c
index 0f603b4094f2..bdbb77334329 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
@@ -58,7 +58,7 @@ static ssize_t format_attr_contextid_show(struct device *dev,
return sprintf(page, "config:%d\n", pid_fmt);
 }
 
-struct device_attribute format_attr_contextid =
+static struct device_attribute format_attr_contextid =
__ATTR(contextid, 0444, format_attr_contextid_show, NULL);
 
 static struct attribute *etm_config_formats_attr[] = {



[PATCH -next RESEND] mfd: ene-kb3930: Make symbol 'kb3930_power_off' static

2021-03-08 Thread 'Wei Yongjun
From: Wei Yongjun 

The sparse tool complains as follows:

drivers/mfd/ene-kb3930.c:36:15: warning:
 symbol 'kb3930_power_off' was not declared. Should it be static?

This symbol is not used outside of ene-kb3930.c, so this
commit marks it static.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
Acked-by: Lubomir Rintel 
---
 drivers/mfd/ene-kb3930.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/ene-kb3930.c b/drivers/mfd/ene-kb3930.c
index 83243e668e3f..1b73318d1f1f 100644
--- a/drivers/mfd/ene-kb3930.c
+++ b/drivers/mfd/ene-kb3930.c
@@ -33,7 +33,7 @@ struct kb3930 {
struct gpio_descs *off_gpios;
 };
 
-struct kb3930 *kb3930_power_off;
+static struct kb3930 *kb3930_power_off;
 
 #define EC_GPIO_WAVE   0
 #define EC_GPIO_OFF_MODE   1



[PATCH -next] clocksource/drivers/ingenic_ost: Fix return value check in ingenic_ost_probe()

2021-03-08 Thread 'Wei Yongjun
From: Wei Yongjun 

In case of error, the function device_node_to_regmap() returns
ERR_PTR() and never returns NULL. The NULL test in the return
value check should be replaced with IS_ERR().

Fixes: ca7b72b5a5f2 ("clocksource: Add driver for the Ingenic JZ47xx OST")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/clocksource/ingenic-ost.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/ingenic-ost.c 
b/drivers/clocksource/ingenic-ost.c
index 029efc2731b4..6af2470136bd 100644
--- a/drivers/clocksource/ingenic-ost.c
+++ b/drivers/clocksource/ingenic-ost.c
@@ -88,9 +88,9 @@ static int __init ingenic_ost_probe(struct platform_device 
*pdev)
return PTR_ERR(ost->regs);
 
map = device_node_to_regmap(dev->parent->of_node);
-   if (!map) {
+   if (IS_ERR(map)) {
dev_err(dev, "regmap not found");
-   return -EINVAL;
+   return PTR_ERR(map);
}
 
ost->clk = devm_clk_get(dev, "ost");



[PATCH -next] regulator: rt4831: Fix return value check in rt4831_regulator_probe()

2021-03-04 Thread 'Wei Yongjun
From: Wei Yongjun 

In case of error, the function dev_get_regmap() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value
check should be replaced with NULL test.

Fixes: 9351ab8b0cb6 ("regulator: rt4831: Adds support for Richtek RT4831 DSV 
regulator")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/regulator/rt4831-regulator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/rt4831-regulator.c 
b/drivers/regulator/rt4831-regulator.c
index 3d4695ded629..e3aaac90d238 100644
--- a/drivers/regulator/rt4831-regulator.c
+++ b/drivers/regulator/rt4831-regulator.c
@@ -153,9 +153,9 @@ static int rt4831_regulator_probe(struct platform_device 
*pdev)
int i, ret;
 
regmap = dev_get_regmap(pdev->dev.parent, NULL);
-   if (IS_ERR(regmap)) {
+   if (!regmap) {
dev_err(>dev, "Failed to init regmap\n");
-   return PTR_ERR(regmap);
+   return -ENODEV;
}
 
/* Configure DSV mode to normal by default */



[PATCH -next] phy: ingenic: Fix a typo in ingenic_usb_phy_probe()

2021-03-04 Thread 'Wei Yongjun
From: Wei Yongjun 

Fix the return value check typo which testing the wrong variable
in ingenic_usb_phy_probe().

Fixes: 31de313dfdcf ("PHY: Ingenic: Add USB PHY driver using generic PHY 
framework.")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/phy/ingenic/phy-ingenic-usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/ingenic/phy-ingenic-usb.c 
b/drivers/phy/ingenic/phy-ingenic-usb.c
index ea127b177f46..28c28d816484 100644
--- a/drivers/phy/ingenic/phy-ingenic-usb.c
+++ b/drivers/phy/ingenic/phy-ingenic-usb.c
@@ -352,8 +352,8 @@ static int ingenic_usb_phy_probe(struct platform_device 
*pdev)
}
 
priv->phy = devm_phy_create(dev, NULL, _usb_phy_ops);
-   if (IS_ERR(priv))
-   return PTR_ERR(priv);
+   if (IS_ERR(priv->phy))
+   return PTR_ERR(priv->phy);
 
phy_set_drvdata(priv->phy, priv);
 



[PATCH -next] phy: ralink: phy-mt7621-pci: fix return value check in mt7621_pci_phy_probe()

2021-03-04 Thread 'Wei Yongjun
From: Wei Yongjun 

Fix the return value check which testing the wrong variable
in mt7621_pci_phy_probe().

Fixes: d87da32372a0 ("phy: ralink: Add PHY driver for MT7621 PCIe PHY")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/phy/ralink/phy-mt7621-pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/ralink/phy-mt7621-pci.c 
b/drivers/phy/ralink/phy-mt7621-pci.c
index 84ee2b5c2228..753cb5bab930 100644
--- a/drivers/phy/ralink/phy-mt7621-pci.c
+++ b/drivers/phy/ralink/phy-mt7621-pci.c
@@ -319,9 +319,9 @@ static int mt7621_pci_phy_probe(struct platform_device 
*pdev)
return PTR_ERR(phy->regmap);
 
phy->phy = devm_phy_create(dev, dev->of_node, _pci_phy_ops);
-   if (IS_ERR(phy)) {
+   if (IS_ERR(phy->phy)) {
dev_err(dev, "failed to create phy\n");
-   return PTR_ERR(phy);
+   return PTR_ERR(phy->phy);
}
 
phy_set_drvdata(phy->phy, phy);



[PATCH -next] mtd: parsers: ofpart: make symbol 'bcm4908_partitions_quirks' static

2021-03-03 Thread 'Wei Yongjun
From: Wei Yongjun 

The sparse tool complains as follows:

drivers/mtd/parsers/ofpart_core.c:25:32: warning:
 symbol 'bcm4908_partitions_quirks' was not declared. Should it be static?

This symbol is not used outside of ofpart_core.c, so this
commit marks it static.

Fixes: 457da931b608 ("mtd: parsers: ofpart: support BCM4908 fixed partitions")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/mtd/parsers/ofpart_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/parsers/ofpart_core.c 
b/drivers/mtd/parsers/ofpart_core.c
index 258c06a42283..e9cb9ca28813 100644
--- a/drivers/mtd/parsers/ofpart_core.c
+++ b/drivers/mtd/parsers/ofpart_core.c
@@ -22,7 +22,7 @@ struct fixed_partitions_quirks {
int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, 
int nr_parts);
 };
 
-struct fixed_partitions_quirks bcm4908_partitions_quirks = {
+static struct fixed_partitions_quirks bcm4908_partitions_quirks = {
.post_parse = bcm4908_partitions_post_parse,
 };
 



[PATCH -next] afs: Remove unused variable in afs_req_issue_op()

2021-03-03 Thread Wei Yongjun
GCC reports the following warning with W=1:

fs/afs/file.c:291:6: warning:
 unused variable 'ret' [-Wunused-variable]
  291 |  int ret;
  |  ^~~

After commit 799fbdf96cd51, this variable is not used in function
afs_req_issue_op(), so this commit remove it to fix the warning.

Fixes: 799fbdf96cd51 ("afs: Use new fscache read helper API")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 fs/afs/file.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/afs/file.c b/fs/afs/file.c
index af162d7dab5b..cf2b664a68a5 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -288,7 +288,6 @@ static void afs_req_issue_op(struct netfs_read_subrequest 
*subreq)
 {
struct afs_vnode *vnode = AFS_FS_I(subreq->rreq->inode);
struct afs_read *fsreq;
-   int ret;
 
fsreq = afs_alloc_read(GFP_NOFS);
if (!fsreq)



[PATCH -next] ASoC: rt1316: Fix return value check in rt1316_sdw_probe()

2021-03-03 Thread Wei Yongjun
In case of error, the function devm_regmap_init_sdw() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Fixes: a262057df513 ("ASoC: rt1316: Add RT1316 SDCA vendor-specific driver")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 sound/soc/codecs/rt1316-sdw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/rt1316-sdw.c b/sound/soc/codecs/rt1316-sdw.c
index a6fb34a48f33..3b029c56467d 100644
--- a/sound/soc/codecs/rt1316-sdw.c
+++ b/sound/soc/codecs/rt1316-sdw.c
@@ -669,8 +669,8 @@ static int rt1316_sdw_probe(struct sdw_slave *slave,
 
/* Regmap Initialization */
regmap = devm_regmap_init_sdw(slave, _sdw_regmap);
-   if (!regmap)
-   return -EINVAL;
+   if (IS_ERR(regmap))
+   return PTR_ERR(regmap);
 
return rt1316_sdw_init(>dev, regmap, slave);
 }



[PATCH -next] drm/amd/display: Fix unused variable warning

2021-02-24 Thread Wei Yongjun
GCC reports the following warning with W=1:

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5439:33:
 warning: unused variable 'dm' [-Wunused-variable]
 5439 |  struct amdgpu_display_manager *dm = >dm;
  | ^~

This variable only used when CONFIG_DRM_AMD_DC_DCN is set, this
commit fix the warning.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index e24a13fd2730..bda8d5f4e56a 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -5436,8 +5436,8 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, 
bool enable)
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
struct amdgpu_device *adev = drm_to_adev(crtc->dev);
struct dm_crtc_state *acrtc_state = to_dm_crtc_state(crtc->state);
-   struct amdgpu_display_manager *dm = >dm;
 #if defined(CONFIG_DRM_AMD_DC_DCN)
+   struct amdgpu_display_manager *dm = >dm;
unsigned long flags;
 #endif
int rc = 0;



[PATCH -next] sound: n64: Fix return value check in n64audio_probe()

2021-02-23 Thread Wei Yongjun
In case of error, the function devm_platform_ioremap_resource()
returns ERR_PTR() and never returns NULL. The NULL test in the
return value check should be replaced with IS_ERR().

Fixes: 1448f8acf4cc ("sound: Add n64 driver")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 sound/mips/snd-n64.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/mips/snd-n64.c b/sound/mips/snd-n64.c
index ca6b4b99da98..e35e93157755 100644
--- a/sound/mips/snd-n64.c
+++ b/sound/mips/snd-n64.c
@@ -312,14 +312,14 @@ static int __init n64audio_probe(struct platform_device 
*pdev)
}
 
priv->mi_reg_base = devm_platform_ioremap_resource(pdev, 0);
-   if (!priv->mi_reg_base) {
-   err = -EINVAL;
+   if (IS_ERR(priv->mi_reg_base)) {
+   err = PTR_ERR(priv->mi_reg_base);
goto fail_dma_alloc;
}
 
priv->ai_reg_base = devm_platform_ioremap_resource(pdev, 1);
-   if (!priv->ai_reg_base) {
-   err = -EINVAL;
+   if (IS_ERR(priv->ai_reg_base)) {
+   err = PTR_ERR(priv->ai_reg_base);
goto fail_dma_alloc;
}
 



[PATCH -next] nvmem: Fix return value check in rmem_read()

2021-02-23 Thread Wei Yongjun
In case of error, the function memremap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.

Fixes: 5a3fa75a4d9c ("nvmem: Add driver to expose reserved memory as nvmem")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/nvmem/rmem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvmem/rmem.c b/drivers/nvmem/rmem.c
index b11c3c974b3d..80cb187f1481 100644
--- a/drivers/nvmem/rmem.c
+++ b/drivers/nvmem/rmem.c
@@ -37,9 +37,9 @@ static int rmem_read(void *context, unsigned int offset,
 * but as of Dec 2020 this isn't possible on arm64.
 */
addr = memremap(priv->mem->base, available, MEMREMAP_WB);
-   if (IS_ERR(addr)) {
+   if (!addr) {
dev_err(priv->dev, "Failed to remap memory region\n");
-   return PTR_ERR(addr);
+   return -ENOMEM;
}
 
count = memory_read_from_buffer(val, bytes, , addr, available);



[PATCH -next] soc: ti: knav_qmss_queue: Make symbol 'knav_acc_firmwares' static

2021-02-09 Thread Wei Yongjun
The sparse tool complains as follows:

drivers/soc/ti/knav_qmss_queue.c:70:12: warning:
 symbol 'knav_acc_firmwares' was not declared. Should it be static?

This symbol is not used outside of knav_qmss_queue.c, so this
commit marks it 'static const char * const'.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/soc/ti/knav_qmss_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
index 2ac3856b8d42..7985c4197cf7 100644
--- a/drivers/soc/ti/knav_qmss_queue.c
+++ b/drivers/soc/ti/knav_qmss_queue.c
@@ -67,7 +67,7 @@ static DEFINE_MUTEX(knav_dev_lock);
  * Newest followed by older ones. Search is done from start of the array
  * until a firmware file is found.
  */
-const char *knav_acc_firmwares[] = {"ks2_qmss_pdsp_acc48.bin"};
+static const char * const knav_acc_firmwares[] = {"ks2_qmss_pdsp_acc48.bin"};
 
 static bool device_ready;
 bool knav_qmss_device_ready(void)



[PATCH -next] soc: mediatek: Make symbol 'mtk_mutex_driver' static

2021-02-09 Thread Wei Yongjun
The sparse tool complains as follows:

drivers/soc/mediatek/mtk-mutex.c:464:24: warning:
 symbol 'mtk_mutex_driver' was not declared. Should it be static?

This symbol is not used outside of mtk-mutex.c, so this
commit marks it static.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/soc/mediatek/mtk-mutex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mutex.c
index f531b119da7a..3a315a62e783 100644
--- a/drivers/soc/mediatek/mtk-mutex.c
+++ b/drivers/soc/mediatek/mtk-mutex.c
@@ -461,7 +461,7 @@ static const struct of_device_id mutex_driver_dt_match[] = {
 };
 MODULE_DEVICE_TABLE(of, mutex_driver_dt_match);
 
-struct platform_driver mtk_mutex_driver = {
+static struct platform_driver mtk_mutex_driver = {
.probe  = mtk_mutex_probe,
.remove = mtk_mutex_remove,
.driver = {



[PATCH -next] mfd: arizona: Make some symbols static

2021-02-09 Thread Wei Yongjun
The sparse tool complains as follows:

drivers/mfd/arizona-spi.c:28:31: warning:
 symbol 'reset_gpios' was not declared. Should it be static?
drivers/mfd/arizona-spi.c:29:31: warning:
 symbol 'ldoena_gpios' was not declared. Should it be static?

Those symbols are not used outside of arizona-spi.c, so this
commit marks them static.

Fixes: e933836744a2 ("mfd: arizona: Add support for ACPI enumeration of WM5102 
connected over SPI")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/mfd/arizona-spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/arizona-spi.c b/drivers/mfd/arizona-spi.c
index 24a2c75d691a..aa1d6f94ae53 100644
--- a/drivers/mfd/arizona-spi.c
+++ b/drivers/mfd/arizona-spi.c
@@ -25,8 +25,8 @@
 #include "arizona.h"
 
 #ifdef CONFIG_ACPI
-const struct acpi_gpio_params reset_gpios = { 1, 0, false };
-const struct acpi_gpio_params ldoena_gpios = { 2, 0, false };
+static const struct acpi_gpio_params reset_gpios = { 1, 0, false };
+static const struct acpi_gpio_params ldoena_gpios = { 2, 0, false };
 
 static const struct acpi_gpio_mapping arizona_acpi_gpios[] = {
{ "reset-gpios", _gpios, 1, },



[PATCH -next] drm/rockchip: cdn-dp: Mark cdn_dp_resume as __maybe_unused

2021-02-09 Thread Wei Yongjun
The function cdn_dp_resume() may have no callers depending
on configuration, so it must be marked __maybe_unused to
avoid harmless warning:

drivers/gpu/drm/rockchip/cdn-dp-core.c:1124:12: warning:
 'cdn_dp_resume' defined but not used [-Wunused-function]
 1124 | static int cdn_dp_resume(struct device *dev)
  |^

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c 
b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index a4a45daf93f2..1162e321aaed 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -1121,7 +1121,7 @@ static int cdn_dp_suspend(struct device *dev)
return ret;
 }
 
-static int cdn_dp_resume(struct device *dev)
+static int __maybe_unused cdn_dp_resume(struct device *dev)
 {
struct cdn_dp_device *dp = dev_get_drvdata(dev);
 



[PATCH -next] NTB: Drop kfree for memory allocated with devm_kzalloc

2021-02-09 Thread Wei Yongjun
It's not necessary to free memory allocated with devm_kzalloc
and using kfree leads to a double free.

Fixes: 363baf7d6051 ("NTB: Add support for EPF PCI-Express Non-Transparent 
Bridge")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/ntb/hw/epf/ntb_hw_epf.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/ntb/hw/epf/ntb_hw_epf.c b/drivers/ntb/hw/epf/ntb_hw_epf.c
index 2cccb7dff5dd..b019755e4e21 100644
--- a/drivers/ntb/hw/epf/ntb_hw_epf.c
+++ b/drivers/ntb/hw/epf/ntb_hw_epf.c
@@ -723,7 +723,6 @@ static void ntb_epf_pci_remove(struct pci_dev *pdev)
ntb_unregister_device(>ntb);
ntb_epf_cleanup_isr(ndev);
ntb_epf_deinit_pci(ndev);
-   kfree(ndev);
 }
 
 static const struct ntb_epf_data j721e_data = {



[tip: core/rcu] locktorture: Make function torture_percpu_rwsem_init() static

2020-10-09 Thread tip-bot2 for Wei Yongjun
The following commit has been merged into the core/rcu branch of tip:

Commit-ID: d49bed9abc3454bd123cbe974ecbeae119701b92
Gitweb:
https://git.kernel.org/tip/d49bed9abc3454bd123cbe974ecbeae119701b92
Author:Wei Yongjun 
AuthorDate:Fri, 03 Jul 2020 13:05:27 +08:00
Committer: Paul E. McKenney 
CommitterDate: Mon, 24 Aug 2020 18:45:32 -07:00

locktorture: Make function torture_percpu_rwsem_init() static

The sparse tool complains as follows:

kernel/locking/locktorture.c:569:6: warning:
 symbol 'torture_percpu_rwsem_init' was not declared. Should it be static?

And this function is not used outside of locktorture.c,
so this commit marks it static.

Signed-off-by: Wei Yongjun 
Signed-off-by: Paul E. McKenney 
---
 kernel/locking/locktorture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 9cfa5e8..62d215b 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -566,7 +566,7 @@ static struct lock_torture_ops rwsem_lock_ops = {
 #include 
 static struct percpu_rw_semaphore pcpu_rwsem;
 
-void torture_percpu_rwsem_init(void)
+static void torture_percpu_rwsem_init(void)
 {
BUG_ON(percpu_init_rwsem(_rwsem));
 }


[tip: core/rcu] scftorture: Make symbol 'scf_torture_rand' static

2020-10-09 Thread tip-bot2 for Wei Yongjun
The following commit has been merged into the core/rcu branch of tip:

Commit-ID: 9a52a574676f8d4aa55f69319231ce6c343b00bb
Gitweb:
https://git.kernel.org/tip/9a52a574676f8d4aa55f69319231ce6c343b00bb
Author:Wei Yongjun 
AuthorDate:Thu, 02 Jul 2020 09:56:50 -07:00
Committer: Paul E. McKenney 
CommitterDate: Mon, 24 Aug 2020 18:38:36 -07:00

scftorture: Make symbol 'scf_torture_rand' static

The sparse tool complains as follows

kernel/scftorture.c:124:1: warning:
 symbol '__pcpu_scope_scf_torture_rand' was not declared. Should it be static?

And this per-CPU variable is not used outside of scftorture.c,
so this commit marks it static.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
Signed-off-by: Paul E. McKenney 
---
 kernel/scftorture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/scftorture.c b/kernel/scftorture.c
index 8349681..9180de7 100644
--- a/kernel/scftorture.c
+++ b/kernel/scftorture.c
@@ -134,7 +134,7 @@ static atomic_t n_alloc_errs;
 static bool scfdone;
 static char *bangstr = "";
 
-DEFINE_TORTURE_RANDOM_PERCPU(scf_torture_rand);
+static DEFINE_TORTURE_RANDOM_PERCPU(scf_torture_rand);
 
 // Print torture statistics.  Caller must ensure serialization.
 static void scf_torture_stats_print(void)


[tip: core/rcu] smp: Make symbol 'csd_bug_count' static

2020-10-09 Thread tip-bot2 for Wei Yongjun
The following commit has been merged into the core/rcu branch of tip:

Commit-ID: 2b722160f1a7929f38dfb648c7bbb45f96e65a5b
Gitweb:
https://git.kernel.org/tip/2b722160f1a7929f38dfb648c7bbb45f96e65a5b
Author:Wei Yongjun 
AuthorDate:Mon, 06 Jul 2020 21:49:41 +08:00
Committer: Paul E. McKenney 
CommitterDate: Fri, 04 Sep 2020 11:53:12 -07:00

smp: Make symbol 'csd_bug_count' static

The sparse tool complains as follows:

kernel/smp.c:107:10: warning:
 symbol 'csd_bug_count' was not declared. Should it be static?

Because variable is not used outside of smp.c, this commit marks it
static.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
Signed-off-by: Paul E. McKenney 
Cc: Peter Zijlstra 
Cc: Ingo Molnar 
Cc: Thomas Gleixner 
Cc: Sebastian Andrzej Siewior 
---
 kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index c5d3188..b25383d 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -106,7 +106,7 @@ static DEFINE_PER_CPU(smp_call_func_t, cur_csd_func);
 static DEFINE_PER_CPU(void *, cur_csd_info);
 
 #define CSD_LOCK_TIMEOUT (5ULL * NSEC_PER_SEC)
-atomic_t csd_bug_count = ATOMIC_INIT(0);
+static atomic_t csd_bug_count = ATOMIC_INIT(0);
 
 /* Record current CSD work for current CPU, NULL to erase. */
 static void csd_lock_record(call_single_data_t *csd)


[PATCH -next] soc: ti: pruss: Fix return value check

2020-09-15 Thread Wei Yongjun
In case of error, the function of_device_get_match_data() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.

Fixes: ba59c9b43c86 ("soc: ti: pruss: support CORECLK_MUX and IEPCLK_MUX")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/soc/ti/pruss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index cc0b4ad7a3d3..582f48051c30 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -126,7 +126,7 @@ static int pruss_clk_init(struct pruss *pruss, struct 
device_node *cfg_node)
int ret = 0;
 
data = of_device_get_match_data(dev);
-   if (IS_ERR(data))
+   if (!data)
return -ENODEV;
 
clks_np = of_get_child_by_name(cfg_node, "clocks");
@@ -175,7 +175,7 @@ static int pruss_probe(struct platform_device *pdev)
const char *mem_names[PRUSS_MEM_MAX] = { "dram0", "dram1", "shrdram2" };
 
data = of_device_get_match_data(>dev);
-   if (IS_ERR(data)) {
+   if (!data) {
dev_err(dev, "missing private data\n");
return -ENODEV;
}





[PATCH -next] mfd: ene-kb3930: Make symbol 'kb3930_power_off' static

2020-09-09 Thread Wei Yongjun
The sparse tool complains as follows:

drivers/mfd/ene-kb3930.c:36:15: warning:
 symbol 'kb3930_power_off' was not declared. Should it be static?

This variable is not used outside of ene-kb3930.c, this commit
marks it static.

Fixes: 753bd752e181 ("mfd: ene-kb3930: Add driver for ENE KB3930 Embedded 
Controller")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/mfd/ene-kb3930.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/ene-kb3930.c b/drivers/mfd/ene-kb3930.c
index 1c32ff586816..eb7312bd6361 100644
--- a/drivers/mfd/ene-kb3930.c
+++ b/drivers/mfd/ene-kb3930.c
@@ -33,7 +33,7 @@ struct kb3930 {
struct gpio_descs *off_gpios;
 };
 
-struct kb3930 *kb3930_power_off;
+static struct kb3930 *kb3930_power_off;
 
 #define EC_GPIO_WAVE   0
 #define EC_GPIO_OFF_MODE   1



[PATCH -next] riscv/mm/fault: fix old-style-declaration warning

2020-09-09 Thread Wei Yongjun
gcc report build warning as follows:

arch/riscv/mm/fault.c:81:1: warning:
 'inline' is not at beginning of declaration [-Wold-style-declaration]
   81 | static void inline vmalloc_fault(struct pt_regs *regs, int code, 
unsigned long addr)
  | ^~

This commit fix it by moving 'inline' after 'static'.

Signed-off-by: Wei Yongjun 
---
 arch/riscv/mm/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
index a23eaf5ce95c..a173432ccf82 100644
--- a/arch/riscv/mm/fault.c
+++ b/arch/riscv/mm/fault.c
@@ -78,7 +78,7 @@ static inline void bad_area(struct pt_regs *regs, struct 
mm_struct *mm, int code
no_context(regs, addr);
 }
 
-static void inline vmalloc_fault(struct pt_regs *regs, int code, unsigned long 
addr)
+static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long 
addr)
 {
pgd_t *pgd, *pgd_k;
pud_t *pud, *pud_k;



[PATCH -next] binderfs: make symbol 'binderfs_fs_parameters' static

2020-08-18 Thread Wei Yongjun
The sparse tool complains as follows:

drivers/android/binderfs.c:66:32: warning:
 symbol 'binderfs_fs_parameters' was not declared. Should it be static?

This variable is not used outside of binderfs.c, so this commit
marks it static.

Fixes: 095cf502b31e ("binderfs: port to new mount api")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/android/binderfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
index 7b76fefde3f8..7b4f154f07e6 100644
--- a/drivers/android/binderfs.c
+++ b/drivers/android/binderfs.c
@@ -63,7 +63,7 @@ static const struct constant_table binderfs_param_stats[] = {
{}
 };
 
-const struct fs_parameter_spec binderfs_fs_parameters[] = {
+static const struct fs_parameter_spec binderfs_fs_parameters[] = {
fsparam_u32("max",  Opt_max),
fsparam_enum("stats",   Opt_stats_mode, binderfs_param_stats),
{}



[PATCH] kernel/relay.c: fix memleak on destroy relay channel

2020-08-17 Thread Wei Yongjun
kmemleak report memory leak as follows:

unreferenced object 0x607ee4e5f948 (size 8):
comm "syz-executor.1", pid 2098, jiffies 4295031601 (age 288.468s)
hex dump (first 8 bytes):
00 00 00 00 00 00 00 00 
backtrace:
[<ca1de2fa>] relay_open kernel/relay.c:583 [inline]
[<ca1de2fa>] relay_open+0xb6/0x970 kernel/relay.c:563
[<38ae5a4b>] do_blk_trace_setup+0x4a8/0xb20 kernel/trace/blktrace.c:557
[<d5e778e9>] __blk_trace_setup+0xb6/0x150 kernel/trace/blktrace.c:597
[<38fdf803>] blk_trace_ioctl+0x146/0x280 kernel/trace/blktrace.c:738
[<ce25a0ca>] blkdev_ioctl+0xb2/0x6a0 block/ioctl.c:613
[<579e47e0>] block_ioctl+0xe5/0x120 fs/block_dev.c:1871
[<b1588c11>] vfs_ioctl fs/ioctl.c:48 [inline]
[<b1588c11>] __do_sys_ioctl fs/ioctl.c:753 [inline]
[<b1588c11>] __se_sys_ioctl fs/ioctl.c:739 [inline]
[<b1588c11>] __x64_sys_ioctl+0x170/0x1ce fs/ioctl.c:739
[<88fc9942>] do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46
[<4f6dd57a>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

'chan->buf' is malloced in relay_open() by alloc_percpu() but not free
while destroy the relay channel. Fix it by adding free_percpu() before
return from relay_destroy_channel().

Fixes: 017c59c042d0 ("relay: Use per CPU constructs for the relay channel 
buffer pointers")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 kernel/relay.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/relay.c b/kernel/relay.c
index 72fe443ea78f..fb4e0c530c08 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -197,6 +197,7 @@ static struct rchan_buf *relay_create_buf(struct rchan 
*chan)
 static void relay_destroy_channel(struct kref *kref)
 {
struct rchan *chan = container_of(kref, struct rchan, kref);
+   free_percpu(chan->buf);
kfree(chan);
 }
 
-- 
2.25.1



[PATCH] memory: jz4780-nemc: Fix return value check in jz4780_nemc_probe()

2020-08-04 Thread Wei Yongjun
In case of error, the function devm_ioremap() returns NULL pointer not
ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: f046e4a3f0b9 ("memory: jz4780_nemc: Only request IO memory the driver 
will use")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/memory/jz4780-nemc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c
index 3ec5cb0fce1e..608ae925e641 100644
--- a/drivers/memory/jz4780-nemc.c
+++ b/drivers/memory/jz4780-nemc.c
@@ -304,9 +304,9 @@ static int jz4780_nemc_probe(struct platform_device *pdev)
}
 
nemc->base = devm_ioremap(dev, res->start, NEMC_REG_LEN);
-   if (IS_ERR(nemc->base)) {
+   if (!nemc->base) {
dev_err(dev, "failed to get I/O memory\n");
-   return PTR_ERR(nemc->base);
+   return -ENOMEM;
}
 
writel(0, nemc->base + NEMC_NFCSR);





[PATCH -next] habanalabs: make some functions static

2020-07-29 Thread Wei Yongjun
The sparse tool complains as follows:

drivers/misc/habanalabs/gaudi/gaudi.c:6275:5: warning:
 symbol 'gaudi_ctx_init' was not declared. Should it be static?
drivers/misc/habanalabs/goya/goya.c:5228:5: warning:
 symbol 'goya_ctx_init' was not declared. Should it be static?

Those functions are not used outside of source file, so this
commit marks them static.

Fixes: a04b7cd97eef ("habanalabs: create internal CB pool")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/misc/habanalabs/gaudi/gaudi.c | 2 +-
 drivers/misc/habanalabs/goya/goya.c | 2 +-
 2 file changed, 2 insertion(+), 2 deletion(-)

diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c 
b/drivers/misc/habanalabs/gaudi/gaudi.c
index d4b3b995f69d..00a0a7238d81 100644
--- a/drivers/misc/habanalabs/gaudi/gaudi.c
+++ b/drivers/misc/habanalabs/gaudi/gaudi.c
@@ -6272,7 +6272,7 @@ static enum hl_device_hw_state gaudi_get_hw_state(struct 
hl_device *hdev)
return RREG32(mmHW_STATE);
 }
 
-int gaudi_ctx_init(struct hl_ctx *ctx)
+static int gaudi_ctx_init(struct hl_ctx *ctx)
 {
return 0;
 }
diff --git a/drivers/misc/habanalabs/goya/goya.c 
b/drivers/misc/habanalabs/goya/goya.c
index dedcd2211fb7..85030759b2af 100644
--- a/drivers/misc/habanalabs/goya/goya.c
+++ b/drivers/misc/habanalabs/goya/goya.c
@@ -5225,7 +5225,7 @@ static enum hl_device_hw_state goya_get_hw_state(struct 
hl_device *hdev)
return RREG32(mmHW_STATE);
 }
 
-int goya_ctx_init(struct hl_ctx *ctx)
+static int goya_ctx_init(struct hl_ctx *ctx)
 {
return 0;
 }



[PATCH -next] irqchip/imx-intmux: Fix irqdata regs save in imx_intmux_runtime_suspend()

2020-07-29 Thread Wei Yongjun
Gcc report warning as follows:

drivers/irqchip/irq-imx-intmux.c:316:29: warning:
 variable 'irqchip_data' set but not used [-Wunused-but-set-variable]
  316 |  struct intmux_irqchip_data irqchip_data;
  | ^~~~

irqdata regs is stored to this variable on the stack in
imx_intmux_runtime_suspend(), which means a nop. this commit
fix to save regs to the right place.

Fixes: bb403111e017 ("irqchip/imx-intmux: Implement intmux runtime power 
management")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/irqchip/irq-imx-intmux.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/irqchip/irq-imx-intmux.c b/drivers/irqchip/irq-imx-intmux.c
index 4c9e40d193d6..e35b7b09c3ab 100644
--- a/drivers/irqchip/irq-imx-intmux.c
+++ b/drivers/irqchip/irq-imx-intmux.c
@@ -313,12 +313,12 @@ static int imx_intmux_remove(struct platform_device *pdev)
 static int imx_intmux_runtime_suspend(struct device *dev)
 {
struct intmux_data *data = dev_get_drvdata(dev);
-   struct intmux_irqchip_data irqchip_data;
+   struct intmux_irqchip_data *irqchip_data;
int i;
 
for (i = 0; i < data->channum; i++) {
-   irqchip_data = data->irqchip_data[i];
-   irqchip_data.saved_reg = readl_relaxed(data->regs + CHANIER(i));
+   irqchip_data = >irqchip_data[i];
+   irqchip_data->saved_reg = readl_relaxed(data->regs + 
CHANIER(i));
}
 
clk_disable_unprepare(data->ipg_clk);
@@ -329,7 +329,7 @@ static int imx_intmux_runtime_suspend(struct device *dev)
 static int imx_intmux_runtime_resume(struct device *dev)
 {
struct intmux_data *data = dev_get_drvdata(dev);
-   struct intmux_irqchip_data irqchip_data;
+   struct intmux_irqchip_data *irqchip_data;
int ret, i;
 
ret = clk_prepare_enable(data->ipg_clk);
@@ -339,8 +339,8 @@ static int imx_intmux_runtime_resume(struct device *dev)
}
 
for (i = 0; i < data->channum; i++) {
-   irqchip_data = data->irqchip_data[i];
-   writel_relaxed(irqchip_data.saved_reg, data->regs + CHANIER(i));
+   irqchip_data = >irqchip_data[i];
+   writel_relaxed(irqchip_data->saved_reg, data->regs + 
CHANIER(i));
}
 
return 0;



[PATCH -next] powerpc/powernv/sriov: Remove unused but set variable 'phb'

2020-07-27 Thread Wei Yongjun
Gcc report warning as follows:

arch/powerpc/platforms/powernv/pci-sriov.c:602:25: warning:
 variable 'phb' set but not used [-Wunused-but-set-variable]
  602 |  struct pnv_phb*phb;
  | ^~~

This variable is not used, so this commit removing it.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 arch/powerpc/platforms/powernv/pci-sriov.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci-sriov.c 
b/arch/powerpc/platforms/powernv/pci-sriov.c
index 8404d8c3901d..7894745fd4f8 100644
--- a/arch/powerpc/platforms/powernv/pci-sriov.c
+++ b/arch/powerpc/platforms/powernv/pci-sriov.c
@@ -599,10 +599,8 @@ static int pnv_pci_vf_resource_shift(struct pci_dev *dev, 
int offset)
 static void pnv_pci_sriov_disable(struct pci_dev *pdev)
 {
u16num_vfs, base_pe;
-   struct pnv_phb*phb;
struct pnv_iov_data   *iov;
 
-   phb = pci_bus_to_pnvhb(pdev->bus);
iov = pnv_iov_get(pdev);
num_vfs = iov->num_vfs;
base_pe = iov->vf_pe_arr[0].pe_number;



[PATCH -next] drm: xlnx: Fix typo in parameter description

2020-07-25 Thread Wei Yongjun
Fix typo in parameter description.

Fixes: d76271d22694 ("drm: xlnx: DRM/KMS driver for Xilinx ZynqMP DisplayPort 
Subsystem")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/gpu/drm/xlnx/zynqmp_dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c
index 821f7a71e182..3d53638ab15e 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_dp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c
@@ -44,7 +44,7 @@ MODULE_PARM_DESC(aux_timeout_ms, "DP aux timeout value in 
msec (default: 50)");
  */
 static uint zynqmp_dp_power_on_delay_ms = 4;
 module_param_named(power_on_delay_ms, zynqmp_dp_power_on_delay_ms, uint, 0444);
-MODULE_PARM_DESC(aux_timeout_ms, "DP power on delay in msec (default: 4)");
+MODULE_PARM_DESC(power_on_delay_ms, "DP power on delay in msec (default: 4)");
 
 /* Link configuration registers */
 #define ZYNQMP_DP_LINK_BW_SET  0x0





[PATCH -next] mtd: fix missing unlock on error in mtdchar_compat_ioctl()

2020-07-25 Thread Wei Yongjun
Add the missing unlock before return from function mtdchar_compat_ioctl()
in the error handling case.

Fixes: 210bec567936 ("mtd: properly check all write ioctls for permissions")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/mtd/mtdchar.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 52c120f9fb0d..b40f46a43fc6 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -1064,8 +1064,10 @@ static long mtdchar_compat_ioctl(struct file *file, 
unsigned int cmd,
struct mtd_oob_buf32 buf;
struct mtd_oob_buf32 __user *buf_user = argp;
 
-   if (!(file->f_mode & FMODE_WRITE))
-   return -EPERM;
+   if (!(file->f_mode & FMODE_WRITE)) {
+   ret = -EPERM;
+   break;
+   }
 
if (copy_from_user(, argp, sizeof(buf)))
ret = -EFAULT;





[PATCH -next] drm/nouveau/kms/nvd9-: Fix file release memory leak

2020-07-21 Thread Wei Yongjun
When using single_open() for opening, single_release() should be
used instead of seq_release(), otherwise there is a memory leak.

Fixes: 12885ecbfe62 ("drm/nouveau/kms/nvd9-: Add CRC support")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/gpu/drm/nouveau/dispnv50/crc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/crc.c 
b/drivers/gpu/drm/nouveau/dispnv50/crc.c
index f17fb6d56757..4971a1042415 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/crc.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/crc.c
@@ -706,6 +706,7 @@ static const struct file_operations 
nv50_crc_flip_threshold_fops = {
.open = nv50_crc_debugfs_flip_threshold_open,
.read = seq_read,
.write = nv50_crc_debugfs_flip_threshold_set,
+   .release = single_release,
 };
 
 int nv50_head_crc_late_register(struct nv50_head *head)





[PATCH -next] mtd: rawnand: pasemi: Make pasemi_device_ready() static

2020-07-21 Thread Wei Yongjun
The sparse tool complains as follows:

drivers/mtd/nand/raw/pasemi_nand.c:71:5: warning:
 symbol 'pasemi_device_ready' was not declared. Should it be static?

This function is not used outside of pasemi_nand.c, so this commit
marks it static.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/mtd/nand/raw/pasemi_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/pasemi_nand.c 
b/drivers/mtd/nand/raw/pasemi_nand.c
index d8eca8c3fdcd..81e2e667037e 100644
--- a/drivers/mtd/nand/raw/pasemi_nand.c
+++ b/drivers/mtd/nand/raw/pasemi_nand.c
@@ -68,7 +68,7 @@ static void pasemi_hwcontrol(struct nand_chip *chip, int cmd,
inl(lpcctl);
 }
 
-int pasemi_device_ready(struct nand_chip *chip)
+static int pasemi_device_ready(struct nand_chip *chip)
 {
return !!(inl(lpcctl) & LBICTRL_LPCCTL_NR);
 }



[PATCH -next] soc: TI knav_qmss: make symbol 'knav_acc_range_ops' static

2020-07-21 Thread Wei Yongjun
The sparse tool complains as follows:

drivers/soc/ti/knav_qmss_acc.c:453:23: warning:
 symbol 'knav_acc_range_ops' was not declared. Should it be static?

'knav_acc_range_ops' is not used outside of knav_qmss_acc.c,
so marks it static.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/soc/ti/knav_qmss_acc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/ti/knav_qmss_acc.c b/drivers/soc/ti/knav_qmss_acc.c
index 1762d89fc05d..fde66e28e046 100644
--- a/drivers/soc/ti/knav_qmss_acc.c
+++ b/drivers/soc/ti/knav_qmss_acc.c
@@ -450,7 +450,7 @@ static int knav_acc_free_range(struct knav_range_info 
*range)
return 0;
 }
 
-struct knav_range_ops knav_acc_range_ops = {
+static struct knav_range_ops knav_acc_range_ops = {
.set_notify = knav_acc_set_notify,
.init_queue = knav_acc_init_queue,
.open_queue = knav_acc_open_queue,



[PATCH -next] bootconfig: Make symbol 'xbc_namebuf' static

2020-07-14 Thread Wei Yongjun
Fix sparse build warning:

init/main.c:305:6: warning:
 symbol 'xbc_namebuf' was not declared. Should it be static?

Signed-off-by: Wei Yongjun 
---
 init/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init/main.c b/init/main.c
index 9127b240fd26..6a24981c727f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -302,7 +302,7 @@ static void * __init get_boot_config_from_initrd(u32 
*_size, u32 *_csum)
 
 #ifdef CONFIG_BOOT_CONFIG
 
-char xbc_namebuf[XBC_KEYLEN_MAX] __initdata;
+static char xbc_namebuf[XBC_KEYLEN_MAX] __initdata;
 
 #define rest(dst, end) ((end) > (dst) ? (end) - (dst) : 0)
 



[PATCH -next] libnvdimm/security: Make __nvdimm_security_overwrite_query() static

2020-07-14 Thread Wei Yongjun
The sparse tool complains as follows:

drivers/nvdimm/security.c:416:6: warning:
 symbol '__nvdimm_security_overwrite_query' was not declared. Should it be 
static?

__nvdimm_security_overwrite_query() is not used outside of this
file, so marks it static.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/nvdimm/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvdimm/security.c b/drivers/nvdimm/security.c
index 89b85970912d..11fb5ada70ad 100644
--- a/drivers/nvdimm/security.c
+++ b/drivers/nvdimm/security.c
@@ -413,7 +413,7 @@ static int security_overwrite(struct nvdimm *nvdimm, 
unsigned int keyid)
return rc;
 }
 
-void __nvdimm_security_overwrite_query(struct nvdimm *nvdimm)
+static void __nvdimm_security_overwrite_query(struct nvdimm *nvdimm)
 {
struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(>dev);
int rc;



[PATCH -next] irqchip: mips-gic: Make some symbols static

2020-07-14 Thread Wei Yongjun
The sparse tool complains as follows:

drivers/irqchip/irq-mips-gic.c:49:1: warning:
 symbol '__pcpu_scope_pcpu_masks' was not declared. Should it be static?
drivers/irqchip/irq-mips-gic.c:620:6: warning:
 symbol 'gic_ipi_domain_free' was not declared. Should it be static?
drivers/irqchip/irq-mips-gic.c:634:5: warning:
 symbol 'gic_ipi_domain_match' was not declared. Should it be static?

Those symbols are not used outside of irq-mips-gic.c, so marks
them static.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/irqchip/irq-mips-gic.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index d70507133c1d..aacfa012c082 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -46,7 +46,7 @@
 
 void __iomem *mips_gic_base;
 
-DEFINE_PER_CPU_READ_MOSTLY(unsigned long[GIC_MAX_LONGS], pcpu_masks);
+static DEFINE_PER_CPU_READ_MOSTLY(unsigned long[GIC_MAX_LONGS], pcpu_masks);
 
 static DEFINE_SPINLOCK(gic_lock);
 static struct irq_domain *gic_irq_domain;
@@ -617,8 +617,8 @@ static int gic_ipi_domain_alloc(struct irq_domain *d, 
unsigned int virq,
return ret;
 }
 
-void gic_ipi_domain_free(struct irq_domain *d, unsigned int virq,
-unsigned int nr_irqs)
+static void gic_ipi_domain_free(struct irq_domain *d, unsigned int virq,
+   unsigned int nr_irqs)
 {
irq_hw_number_t base_hwirq;
struct irq_data *data;
@@ -631,8 +631,8 @@ void gic_ipi_domain_free(struct irq_domain *d, unsigned int 
virq,
bitmap_set(ipi_available, base_hwirq, nr_irqs);
 }
 
-int gic_ipi_domain_match(struct irq_domain *d, struct device_node *node,
-enum irq_domain_bus_token bus_token)
+static int gic_ipi_domain_match(struct irq_domain *d, struct device_node *node,
+   enum irq_domain_bus_token bus_token)
 {
bool is_ipi;
 



Re: [PATCH v2 net] rtnetlink: Fix memory(net_device) leak when ->newlink fails

2020-07-14 Thread Wei Yongjun



On 2020/7/14 15:32, Weilong Chen wrote:
> When vlan_newlink call register_vlan_dev fails, it might return error
> with dev->reg_state = NETREG_UNREGISTERED. The rtnl_newlink should
> free the memory. But currently rtnl_newlink only free the memory which
> state is NETREG_UNINITIALIZED.
> 
> BUG: memory leak
> unreferenced object 0x8881051de000 (size 4096):
>   comm "syz-executor139", pid 560, jiffies 4294745346 (age 32.445s)
>   hex dump (first 32 bytes):
> 76 6c 61 6e 32 00 00 00 00 00 00 00 00 00 00 00  vlan2...
> 00 45 28 03 81 88 ff ff 00 00 00 00 00 00 00 00  .E(.
>   backtrace:
> [<47527e31>] kmalloc_node include/linux/slab.h:578 [inline]
> [<47527e31>] kvmalloc_node+0x33/0xd0 mm/util.c:574
> [<2b59e3bc>] kvmalloc include/linux/mm.h:753 [inline]
> [<2b59e3bc>] kvzalloc include/linux/mm.h:761 [inline]
> [<2b59e3bc>] alloc_netdev_mqs+0x83/0xd90 net/core/dev.c:9929
> [<6076752a>] rtnl_create_link+0x2c0/0xa20 
> net/core/rtnetlink.c:3067
> [<572b3be5>] __rtnl_newlink+0xc9c/0x1330 net/core/rtnetlink.c:3329
> [] rtnl_newlink+0x66/0x90 net/core/rtnetlink.c:3397
> [<52c7c0a9>] rtnetlink_rcv_msg+0x540/0x990 
> net/core/rtnetlink.c:5460
> [<4b5cb379>] netlink_rcv_skb+0x12b/0x3a0 
> net/netlink/af_netlink.c:2469
> [] netlink_unicast_kernel net/netlink/af_netlink.c:1303 
> [inline]
> [] netlink_unicast+0x4c6/0x690 
> net/netlink/af_netlink.c:1329
> [] netlink_sendmsg+0x735/0xcc0 
> net/netlink/af_netlink.c:1918
> [<9221ebf7>] sock_sendmsg_nosec net/socket.c:652 [inline]
> [<9221ebf7>] sock_sendmsg+0x109/0x140 net/socket.c:672
> [<1c30ffe4>] sys_sendmsg+0x5f5/0x780 net/socket.c:2352
> [] ___sys_sendmsg+0x11d/0x1a0 net/socket.c:2406
> [<07297384>] __sys_sendmsg+0xeb/0x1b0 net/socket.c:2439
> [<0eb29b11>] do_syscall_64+0x56/0xa0 arch/x86/entry/common.c:359
> [<6839b4d0>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
> 
> Fixes: commit e51fb152318ee6 (rtnetlink: fix a memory leak when ->newlink 
> fails)

Should be:

Fixes: e51fb152318ee6 ("rtnetlink: fix a memory leak when ->newlink fails")



[PATCH -next] iommu: Make some functions static

2020-07-13 Thread Wei Yongjun
The sparse tool complains as follows:

drivers/iommu/iommu.c:386:5: warning:
 symbol 'iommu_insert_resv_region' was not declared. Should it be static?
drivers/iommu/iommu.c:2182:5: warning:
 symbol '__iommu_map' was not declared. Should it be static?

Those functions are not used outside of iommu.c, so mark them static.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/iommu/iommu.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 1ed1e14a1f0c..40947f5bc6c5 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -383,8 +383,8 @@ static ssize_t iommu_group_show_name(struct iommu_group 
*group, char *buf)
  * Elements are sorted by start address and overlapping segments
  * of the same type are merged.
  */
-int iommu_insert_resv_region(struct iommu_resv_region *new,
-struct list_head *regions)
+static int iommu_insert_resv_region(struct iommu_resv_region *new,
+   struct list_head *regions)
 {
struct iommu_resv_region *iter, *tmp, *nr, *top;
LIST_HEAD(stack);
@@ -2179,8 +2179,8 @@ static size_t iommu_pgsize(struct iommu_domain *domain,
return pgsize;
 }
 
-int __iommu_map(struct iommu_domain *domain, unsigned long iova,
- phys_addr_t paddr, size_t size, int prot, gfp_t gfp)
+static int __iommu_map(struct iommu_domain *domain, unsigned long iova,
+  phys_addr_t paddr, size_t size, int prot, gfp_t gfp)
 {
const struct iommu_ops *ops = domain->ops;
unsigned long orig_iova = iova;



[PATCH -next] ftrace: Make ftrace_profile_pages_init() static

2020-07-13 Thread Wei Yongjun
The sparse tool complains as follows:

kernel/trace/ftrace.c:587:5: warning:
 symbol 'ftrace_profile_pages_init' was not declared. Should it be static?

ftrace_profile_pages_init() is not used out of ftrace.c, so
marks it static.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 kernel/trace/ftrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index a3093a84bae3..3e9369935cb3 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -584,7 +584,7 @@ static void ftrace_profile_reset(struct ftrace_profile_stat 
*stat)
   FTRACE_PROFILE_HASH_SIZE * sizeof(struct hlist_head));
 }
 
-int ftrace_profile_pages_init(struct ftrace_profile_stat *stat)
+static int ftrace_profile_pages_init(struct ftrace_profile_stat *stat)
 {
struct ftrace_profile_page *pg;
int functions;



[PATCH -next] device-dax: make dev_dax_kmem_probe() static

2020-07-07 Thread Wei Yongjun
sparse report warning as follows:

drivers/dax/kmem.c:22:5: warning:
 symbol 'dev_dax_kmem_probe' was not declared. Should it be static?

dev_dax_kmem_probe() is not used outside of kmem.c, so marks
it static.

Signed-off-by: Wei Yongjun 
---
 drivers/dax/kmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c
index 275aa5f87399..87e271668170 100644
--- a/drivers/dax/kmem.c
+++ b/drivers/dax/kmem.c
@@ -19,7 +19,7 @@ static const char *kmem_name;
 /* Set if any memory will remain added when the driver will be unloaded. */
 static bool any_hotremove_failed;
 
-int dev_dax_kmem_probe(struct device *dev)
+static int dev_dax_kmem_probe(struct device *dev)
 {
struct dev_dax *dev_dax = to_dev_dax(dev);
struct resource *res = _dax->region->res;



[PATCH -next] lib/test_lockup.c: make symbol 'test_works' static

2020-07-07 Thread Wei Yongjun
Fix sparse build warning:

lib/test_lockup.c:403:1: warning:
 symbol '__pcpu_scope_test_works' was not declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 lib/test_lockup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_lockup.c b/lib/test_lockup.c
index ff26f36d729f..0f81252837b9 100644
--- a/lib/test_lockup.c
+++ b/lib/test_lockup.c
@@ -400,7 +400,7 @@ static void test_lockup(bool master)
test_unlock(master, true);
 }
 
-DEFINE_PER_CPU(struct work_struct, test_works);
+static DEFINE_PER_CPU(struct work_struct, test_works);
 
 static void test_work_fn(struct work_struct *work)
 {



[PATCH -next] smp: Make symbol 'csd_bug_count' static

2020-07-06 Thread Wei Yongjun
The sparse tool complains as follows

kernel/smp.c:107:10: warning:
 symbol 'csd_bug_count' was not declared. Should it be static?

This variable is not used outside of smp.c, s this commit marks
it static.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index 6ec6c9578225..65822c1c3e67 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -104,7 +104,7 @@ void __init call_function_init(void)
 }
 
 #define CSD_LOCK_TIMEOUT (5 * 1000ULL) /* Milliseconds. */
-atomic_t csd_bug_count = ATOMIC_INIT(0);
+static atomic_t csd_bug_count = ATOMIC_INIT(0);
 
 /* Record current CSD work for current CPU, NULL to erase. */
 static void csd_lock_record(call_single_data_t *csd)



[PATCH -next] smp: Fix unused-but-set-variable warning

2020-07-06 Thread Wei Yongjun
Gcc report build warning as follows:

kernel/smp.c:126:15: warning:
 variable 'csd_type' set but not used [-Wunused-but-set-variable]
  126 |  unsigned int csd_type;
  |   ^~~~

'csd_type' is only used when CONFIG_64BIT defined, so move them
under '#ifdef'.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index 6ec6c9578225..0130bdcf6d26 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -123,10 +123,10 @@ static void csd_lock_record(call_single_data_t *csd)
 
 static __always_inline int csd_lock_wait_getcpu(call_single_data_t *csd)
 {
+#ifdef CONFIG_64BIT
unsigned int csd_type;
 
csd_type = CSD_TYPE(csd);
-#ifdef CONFIG_64BIT
if (csd_type == CSD_TYPE_ASYNC || csd_type == CSD_TYPE_SYNC)
return csd->dst; // Other CSD_TYPE_ values might not have ->dst.
 #endif



[PATCH -next] locktorture: make function torture_percpu_rwsem_init() static

2020-07-02 Thread Wei Yongjun
The sparse tool complains as follows:

kernel/locking/locktorture.c:569:6: warning:
 symbol 'torture_percpu_rwsem_init' was not declared. Should it be static?

And this function is not used outside of locktorture.c,
so this commit marks it static.

Signed-off-by: Wei Yongjun 
---
 kernel/locking/locktorture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 9cfa5e89cff7..62d215b2e39f 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -566,7 +566,7 @@ static struct lock_torture_ops rwsem_lock_ops = {
 #include 
 static struct percpu_rw_semaphore pcpu_rwsem;
 
-void torture_percpu_rwsem_init(void)
+static void torture_percpu_rwsem_init(void)
 {
BUG_ON(percpu_init_rwsem(_rwsem));
 }



[PATCH -next] ASoC: ti: j721e-evm: Fix missing unlock on error in j721e_audio_hw_params()

2020-07-02 Thread Wei Yongjun
Add the missing unlock before return from function j721e_audio_hw_params()
in the error handling case.

Fixes: 6748d0559059 ("ASoC: ti: Add custom machine driver for j721e EVM (CPB 
and IVI)")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 sound/soc/ti/j721e-evm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/ti/j721e-evm.c b/sound/soc/ti/j721e-evm.c
index 3a2a8b1f3aa3..174306cf53ad 100644
--- a/sound/soc/ti/j721e-evm.c
+++ b/sound/soc/ti/j721e-evm.c
@@ -330,7 +330,7 @@ static int j721e_audio_hw_params(struct snd_pcm_substream 
*substream,
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x3, 0x3, 2,
   slot_width);
if (ret && ret != -ENOTSUPP)
-   return ret;
+   goto out;
}
 
ret = j721e_configure_refclk(priv, domain_id, params_rate(params));





[PATCH -next] dm zoned: fix unused but set variable warnings

2020-07-02 Thread Wei Yongjun
Fix unused but set variable warnings:

drivers/md/dm-zoned-reclaim.c:504:42: warning:
 variable nr_rnd set but not used [-Wunused-but-set-variable]
  504 |  unsigned int p_unmap, nr_unmap_rnd = 0, nr_rnd = 0;
  |  ^~
drivers/md/dm-zoned-reclaim.c:504:24: warning:
 variable nr_unmap_rnd set but not used [-Wunused-but-set-variable]
  504 |  unsigned int p_unmap, nr_unmap_rnd = 0, nr_rnd = 0;
  |^~~~

Fixes: f97809aec589 ("dm zoned: per-device reclaim")
Signed-off-by: Wei Yongjun 
---
 drivers/md/dm-zoned-reclaim.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/md/dm-zoned-reclaim.c b/drivers/md/dm-zoned-reclaim.c
index dd1eebf6e50f..7e0cc2d732cf 100644
--- a/drivers/md/dm-zoned-reclaim.c
+++ b/drivers/md/dm-zoned-reclaim.c
@@ -501,7 +501,7 @@ static void dmz_reclaim_work(struct work_struct *work)
 {
struct dmz_reclaim *zrc = container_of(work, struct dmz_reclaim, 
work.work);
struct dmz_metadata *zmd = zrc->metadata;
-   unsigned int p_unmap, nr_unmap_rnd = 0, nr_rnd = 0;
+   unsigned int p_unmap;
int ret;
 
if (dmz_dev_is_dying(zmd))
@@ -527,9 +527,6 @@ static void dmz_reclaim_work(struct work_struct *work)
zrc->kc_throttle.throttle = min(75U, 100U - p_unmap / 2);
}
 
-   nr_unmap_rnd = dmz_nr_unmap_rnd_zones(zmd, zrc->dev_idx);
-   nr_rnd = dmz_nr_rnd_zones(zmd, zrc->dev_idx);
-
DMDEBUG("(%s/%u): Reclaim (%u): %s, %u%% free zones (%u/%u cache %u/%u 
random)",
dmz_metadata_label(zmd), zrc->dev_idx,
zrc->kc_throttle.throttle,



[PATCH -next] lib/test_bits: make some functions static

2020-07-02 Thread Wei Yongjun
Fix sparse build warnings:

lib/test_bits.c:10:6: warning:
 symbol 'genmask_test' was not declared. Should it be static?
lib/test_bits.c:27:6: warning:
 symbol 'genmask_ull_test' was not declared. Should it be static?
lib/test_bits.c:42:6: warning:
 symbol 'genmask_input_check_test' was not declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 lib/test_bits.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/test_bits.c b/lib/test_bits.c
index 89e0ea83511f..c9368a2314e7 100644
--- a/lib/test_bits.c
+++ b/lib/test_bits.c
@@ -7,7 +7,7 @@
 #include 
 
 
-void genmask_test(struct kunit *test)
+static void genmask_test(struct kunit *test)
 {
KUNIT_EXPECT_EQ(test, 1ul, GENMASK(0, 0));
KUNIT_EXPECT_EQ(test, 3ul, GENMASK(1, 0));
@@ -24,7 +24,7 @@ void genmask_test(struct kunit *test)
 
 }
 
-void genmask_ull_test(struct kunit *test)
+static void genmask_ull_test(struct kunit *test)
 {
KUNIT_EXPECT_EQ(test, 1ull, GENMASK_ULL(0, 0));
KUNIT_EXPECT_EQ(test, 3ull, GENMASK_ULL(1, 0));
@@ -39,7 +39,7 @@ void genmask_ull_test(struct kunit *test)
 #endif
 }
 
-void genmask_input_check_test(struct kunit *test)
+static void genmask_input_check_test(struct kunit *test)
 {
unsigned int x, y;
int z, w;



[PATCH -next] scftorture: Make symbol 'scf_torture_rand' static

2020-07-02 Thread Wei Yongjun
Fix sparse build warning:

kernel/scftorture.c:124:1: warning:
 symbol '__pcpu_scope_scf_torture_rand' was not declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 kernel/scftorture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/scftorture.c b/kernel/scftorture.c
index 52750c564404..d63d700ad297 100644
--- a/kernel/scftorture.c
+++ b/kernel/scftorture.c
@@ -121,7 +121,7 @@ static unsigned long scf_sel_totweight;
 static atomic_t n_started;
 static atomic_t n_errs;
 
-DEFINE_TORTURE_RANDOM_PERCPU(scf_torture_rand);
+static DEFINE_TORTURE_RANDOM_PERCPU(scf_torture_rand);
 
 // Print torture statistics.  Caller must ensure serialization.
 static void scf_torture_stats_print(void)



[PATCH -next] kcov: make some symbols static

2020-07-02 Thread Wei Yongjun
Fix sparse build warnings:

kernel/kcov.c:99:1: warning:
 symbol '__pcpu_scope_kcov_percpu_data' was not declared. Should it be static?
kernel/kcov.c:778:6: warning:
 symbol 'kcov_remote_softirq_start' was not declared. Should it be static?
kernel/kcov.c:795:6: warning:
 symbol 'kcov_remote_softirq_stop' was not declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 kernel/kcov.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/kcov.c b/kernel/kcov.c
index 6afae0bcbac4..6b8368be89c8 100644
--- a/kernel/kcov.c
+++ b/kernel/kcov.c
@@ -96,7 +96,7 @@ struct kcov_percpu_data {
int saved_sequence;
 };
 
-DEFINE_PER_CPU(struct kcov_percpu_data, kcov_percpu_data);
+static DEFINE_PER_CPU(struct kcov_percpu_data, kcov_percpu_data);
 
 /* Must be called with kcov_remote_lock locked. */
 static struct kcov_remote *kcov_remote_find(u64 handle)
@@ -775,7 +775,7 @@ static inline bool kcov_mode_enabled(unsigned int mode)
return (mode & ~KCOV_IN_CTXSW) != KCOV_MODE_DISABLED;
 }
 
-void kcov_remote_softirq_start(struct task_struct *t)
+static void kcov_remote_softirq_start(struct task_struct *t)
 {
struct kcov_percpu_data *data = this_cpu_ptr(_percpu_data);
unsigned int mode;
@@ -792,7 +792,7 @@ void kcov_remote_softirq_start(struct task_struct *t)
}
 }
 
-void kcov_remote_softirq_stop(struct task_struct *t)
+static void kcov_remote_softirq_stop(struct task_struct *t)
 {
struct kcov_percpu_data *data = this_cpu_ptr(_percpu_data);
 



[PATCH -next] dm: remove unused variable 'md'

2020-07-02 Thread Wei Yongjun
After commit 5a6c35f9af41 ("block: remove direct_make_request"),
'md' is never used and gcc report build warning:

drivers/md/dm.c:1296:24: warning: unused variable 'md' [-Wunused-variable]
 1296 |  struct mapped_device *md = io->md;
  |^~

Removing it to avoid build warning.

Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/md/dm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index a8d83d76fa9f..a02842afe358 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1293,7 +1293,6 @@ static blk_qc_t __map_bio(struct dm_target_io *tio)
sector_t sector;
struct bio *clone = >clone;
struct dm_io *io = tio->io;
-   struct mapped_device *md = io->md;
struct dm_target *ti = tio->ti;
blk_qc_t ret = BLK_QC_T_NONE;
 



[PATCH -next] f2fs: make __allocate_new_segment() static

2020-07-01 Thread Wei Yongjun
From: Hulk Robot 

From: Hulk Robot 

Fix sparse build warning:

fs/f2fs/segment.c:2736:6: warning:
 symbol '__allocate_new_segment' was not declared. Should it be static?

Signed-off-by: Hulk Robot 
---
 fs/f2fs/segment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index b45e473508a9..c35614d255e1 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2733,7 +2733,7 @@ void f2fs_allocate_segment_for_resize(struct f2fs_sb_info 
*sbi, int type,
up_read(_I(sbi)->curseg_lock);
 }
 
-void __allocate_new_segment(struct f2fs_sb_info *sbi, int type)
+static void __allocate_new_segment(struct f2fs_sb_info *sbi, int type)
 {
struct curseg_info *curseg = CURSEG_I(sbi, type);
unsigned int old_segno;



[PATCH] drm/panel: otm8009a: Drop unnessary backlight_device_unregister()

2020-06-18 Thread Wei Yongjun
It's not necessary to unregister backlight device which
registered with devm_backlight_device_register().

Fixes: 12a6cbd4f3f1 ("drm/panel: otm8009a: Use new backlight API")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c 
b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index 895ee3d1371e..d956522f32ee 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -479,7 +479,6 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
if (ret < 0) {
dev_err(dev, "mipi_dsi_attach failed. Is host ready?\n");
drm_panel_remove(>panel);
-   backlight_device_unregister(ctx->bl_dev);
return ret;
}





[PATCH -next] ASoC: mmp-sspa: Fix return value check in asoc_mmp_sspa_probe()

2020-05-26 Thread Wei Yongjun
In case of error, the function devm_ioremap() returns NULL pointer not
ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Signed-off-by: Wei Yongjun 
---
 sound/soc/pxa/mmp-sspa.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/pxa/mmp-sspa.c b/sound/soc/pxa/mmp-sspa.c
index 3e37ab625f8d..4255851c71c1 100644
--- a/sound/soc/pxa/mmp-sspa.c
+++ b/sound/soc/pxa/mmp-sspa.c
@@ -493,13 +493,13 @@ static int asoc_mmp_sspa_probe(struct platform_device 
*pdev)
return -ENODEV;
 
sspa->rx_base = devm_ioremap(>dev, res->start, 0x30);
-   if (IS_ERR(sspa->rx_base))
-   return PTR_ERR(sspa->rx_base);
+   if (!sspa->rx_base)
+   return -ENOMEM;
 
sspa->tx_base = devm_ioremap(>dev,
 res->start + 0x80, 0x30);
-   if (IS_ERR(sspa->tx_base))
-   return PTR_ERR(sspa->tx_base);
+   if (!sspa->tx_base)
+   return -ENOMEM;
 
sspa->clk = devm_clk_get(>dev, NULL);
if (IS_ERR(sspa->clk))







[PATCH -next] bus: arm-integrator-lm: Fix return value check in integrator_ap_lm_probe()

2020-05-19 Thread Wei Yongjun
In case of error, the function of_find_matching_node() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.

Fixes: ccea5e8a5918 ("bus: Add driver for Integrator/AP logic modules")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/bus/arm-integrator-lm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/arm-integrator-lm.c b/drivers/bus/arm-integrator-lm.c
index 669ea7e1f92e..845b6c43fef8 100644
--- a/drivers/bus/arm-integrator-lm.c
+++ b/drivers/bus/arm-integrator-lm.c
@@ -78,10 +78,10 @@ static int integrator_ap_lm_probe(struct platform_device 
*pdev)
 
/* Look up the system controller */
syscon = of_find_matching_node(NULL, integrator_ap_syscon_match);
-   if (IS_ERR(syscon)) {
+   if (!syscon) {
dev_err(dev,
"could not find Integrator/AP system controller\n");
-   return PTR_ERR(syscon);
+   return -ENODEV;
}
map = syscon_node_to_regmap(syscon);
if (IS_ERR(map)) {





[PATCH -next] iommu/sun50i: Fix return value check in sun50i_iommu_probe()

2020-05-19 Thread Wei Yongjun
In case of error, the function devm_platform_ioremap_resource() returns
ERR_PTR() not NULL. The NULL test in the return value check must be
replaced with IS_ERR().

Fixes: 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/iommu/sun50i-iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c
index 9c763d4a8e2a..1fa09ddcebd4 100644
--- a/drivers/iommu/sun50i-iommu.c
+++ b/drivers/iommu/sun50i-iommu.c
@@ -941,7 +941,7 @@ static int sun50i_iommu_probe(struct platform_device *pdev)
}
 
iommu->base = devm_platform_ioremap_resource(pdev, 0);
-   if (!iommu->base) {
+   if (IS_ERR(iommu->base)) {
ret = PTR_ERR(iommu->base);
goto err_free_group;
}





[PATCH -next] ASoC: SOF: core: fix error return code in sof_probe_continue()

2020-05-09 Thread Wei Yongjun
Fix to return negative error code -ENOMEM from the IPC init error
handling case instead of 0, as done elsewhere in this function.

Fixes: c16211d6226d ("ASoC: SOF: Add Sound Open Firmware driver core")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 sound/soc/sof/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c
index 94a2cb58ab9a..ef9be4f45e27 100644
--- a/sound/soc/sof/core.c
+++ b/sound/soc/sof/core.c
@@ -176,6 +176,7 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)
/* init the IPC */
sdev->ipc = snd_sof_ipc_init(sdev);
if (!sdev->ipc) {
+   ret = -ENOMEM;
dev_err(sdev->dev, "error: failed to init DSP IPC %d\n", ret);
goto ipc_err;
}





[PATCH -next] mm/hmm/test: fix missing unlock on error in dmirror_migrate_finalize_and_map()

2020-05-08 Thread Wei Yongjun
Add the missing unlock before return from function
dmirror_migrate_finalize_and_map() in the error
handling case.

Fixes: 5d5e54be8a1e ("mm/hmm/test: add selftest driver for HMM")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 lib/test_hmm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index 00bca6116f93..30462193c4ff 100644
--- a/lib/test_hmm.c
+++ b/lib/test_hmm.c
@@ -647,8 +647,10 @@ static int dmirror_migrate_finalize_and_map(struct 
migrate_vma *args,
if (*dst & MIGRATE_PFN_WRITE)
entry = xa_tag_pointer(entry, DPT_XA_TAG_WRITE);
entry = xa_store(>pt, pfn, entry, GFP_ATOMIC);
-   if (xa_is_err(entry))
+   if (xa_is_err(entry)) {
+   mutex_unlock(>mutex);
return xa_err(entry);
+   }
}
 
mutex_unlock(>mutex);





[PATCH -next] mm/hmm/test: fix error return code in hmm_dmirror_init()

2020-05-08 Thread Wei Yongjun
Fix to return negative error code -ENOMEM from the alloc_page() error
handling case instead of 0, as done elsewhere in this function.

Fixes: 5d5e54be8a1e ("mm/hmm/test: add selftest driver for HMM")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 lib/test_hmm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index 00bca6116f93..b4d9434e49e7 100644
--- a/lib/test_hmm.c
+++ b/lib/test_hmm.c
@@ -1119,8 +1119,10 @@ static int __init hmm_dmirror_init(void)
 * make the code here simpler (i.e., we need a struct page for it).
 */
dmirror_zero_page = alloc_page(GFP_HIGHUSER | __GFP_ZERO);
-   if (!dmirror_zero_page)
+   if (!dmirror_zero_page) {
+   ret = -ENOMEM;
goto err_chrdev;
+   }
 
pr_info("HMM test module loaded. This is only for testing HMM.\n");
return 0;





[tip: locking/kcsan] kcsan: Use GFP_ATOMIC under spin lock

2020-05-08 Thread tip-bot2 for Wei Yongjun
The following commit has been merged into the locking/kcsan branch of tip:

Commit-ID: 52785b6ae8eded7ac99d65c92d989b702e5b4376
Gitweb:
https://git.kernel.org/tip/52785b6ae8eded7ac99d65c92d989b702e5b4376
Author:Wei Yongjun 
AuthorDate:Fri, 17 Apr 2020 02:58:37 
Committer: Paul E. McKenney 
CommitterDate: Mon, 27 Apr 2020 11:10:10 -07:00

kcsan: Use GFP_ATOMIC under spin lock

A spin lock is held in insert_report_filterlist(), so the krealloc()
should use GFP_ATOMIC.  This commit therefore makes this change.

Reviewed-by: Marco Elver 
Signed-off-by: Wei Yongjun 
Signed-off-by: Paul E. McKenney 
---
 kernel/kcsan/debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/kcsan/debugfs.c b/kernel/kcsan/debugfs.c
index 1a08664..023e49c 100644
--- a/kernel/kcsan/debugfs.c
+++ b/kernel/kcsan/debugfs.c
@@ -230,7 +230,7 @@ static ssize_t insert_report_filterlist(const char *func)
/* initial allocation */
report_filterlist.addrs =
kmalloc_array(report_filterlist.size,
- sizeof(unsigned long), GFP_KERNEL);
+ sizeof(unsigned long), GFP_ATOMIC);
if (report_filterlist.addrs == NULL) {
ret = -ENOMEM;
goto out;
@@ -240,7 +240,7 @@ static ssize_t insert_report_filterlist(const char *func)
size_t new_size = report_filterlist.size * 2;
unsigned long *new_addrs =
krealloc(report_filterlist.addrs,
-new_size * sizeof(unsigned long), GFP_KERNEL);
+new_size * sizeof(unsigned long), GFP_ATOMIC);
 
if (new_addrs == NULL) {
/* leave filterlist itself untouched */


[PATCH -next] gnss: sirf: fix error return code in sirf_probe()

2020-05-07 Thread Wei Yongjun
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: d2efbbd18b1e ("gnss: add driver for sirfstar-based receivers")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/gnss/sirf.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gnss/sirf.c b/drivers/gnss/sirf.c
index effed3a8d398..2ecb1d3e8eeb 100644
--- a/drivers/gnss/sirf.c
+++ b/drivers/gnss/sirf.c
@@ -439,14 +439,18 @@ static int sirf_probe(struct serdev_device *serdev)
 
data->on_off = devm_gpiod_get_optional(dev, "sirf,onoff",
GPIOD_OUT_LOW);
-   if (IS_ERR(data->on_off))
+   if (IS_ERR(data->on_off)) {
+   ret = PTR_ERR(data->on_off);
goto err_put_device;
+   }
 
if (data->on_off) {
data->wakeup = devm_gpiod_get_optional(dev, "sirf,wakeup",
GPIOD_IN);
-   if (IS_ERR(data->wakeup))
+   if (IS_ERR(data->wakeup)) {
+   ret = PTR_ERR(data->wakeup);
goto err_put_device;
+   }
 
ret = regulator_enable(data->vcc);
if (ret)





[PATCH -next] ASoC: rt5677: Use devm_snd_soc_register_component()

2020-05-07 Thread Wei Yongjun
Using devm_snd_soc_register_component() can make the code
shorter and cleaner.

Signed-off-by: Wei Yongjun 
---
 sound/soc/codecs/rt5677-spi.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/sound/soc/codecs/rt5677-spi.c b/sound/soc/codecs/rt5677-spi.c
index 3f40d2751833..7bfade8b3d6e 100644
--- a/sound/soc/codecs/rt5677-spi.c
+++ b/sound/soc/codecs/rt5677-spi.c
@@ -605,20 +605,15 @@ static int rt5677_spi_probe(struct spi_device *spi)
 
g_spi = spi;
 
-   ret = snd_soc_register_component(>dev, _spi_dai_component,
-_spi_dai, 1);
+   ret = devm_snd_soc_register_component(>dev,
+ _spi_dai_component,
+ _spi_dai, 1);
if (ret < 0)
dev_err(>dev, "Failed to register component.\n");
 
return ret;
 }
 
-static int rt5677_spi_remove(struct spi_device *spi)
-{
-   snd_soc_unregister_component(>dev);
-   return 0;
-}
-
 static const struct acpi_device_id rt5677_spi_acpi_id[] = {
{ "RT5677AA", 0 },
{ }
@@ -631,7 +626,6 @@ static struct spi_driver rt5677_spi_driver = {
.acpi_match_table = ACPI_PTR(rt5677_spi_acpi_id),
},
.probe = rt5677_spi_probe,
-   .remove = rt5677_spi_remove,
 };
 module_spi_driver(rt5677_spi_driver);
 







[PATCH -next] ipack: tpci200: fix error return code in tpci200_register()

2020-05-07 Thread Wei Yongjun
Fix to return negative error code -ENOMEM from the ioremap() error handling
case instead of 0, as done elsewhere in this function.

Fixes: 43986798fd50 ("ipack: add error handling for ioremap_nocache")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/ipack/carriers/tpci200.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ipack/carriers/tpci200.c b/drivers/ipack/carriers/tpci200.c
index 8a9c169..b5eec18 100644
--- a/drivers/ipack/carriers/tpci200.c
+++ b/drivers/ipack/carriers/tpci200.c
@@ -309,6 +309,7 @@ static int tpci200_register(struct tpci200_board *tpci200)
"(bn 0x%X, sn 0x%X) failed to map driver user space!",
tpci200->info->pdev->bus->number,
tpci200->info->pdev->devfn);
+   res = -ENOMEM;
goto out_release_mem8_space;
}





[PATCH -next] phy: ti: j721e-wiz: Fix some error return code in wiz_probe()

2020-05-06 Thread Wei Yongjun
Fix to return negative error code from some error handling
cases instead of 0, as done elsewhere in this function.

Fixes: 091876cc355d ("phy: ti: j721e-wiz: Add support for WIZ module present in 
TI J721E SoC")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/phy/ti/phy-j721e-wiz.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c
index 1d12d1b1b63a..30ea5b207285 100644
--- a/drivers/phy/ti/phy-j721e-wiz.c
+++ b/drivers/phy/ti/phy-j721e-wiz.c
@@ -841,8 +841,10 @@ static int wiz_probe(struct platform_device *pdev)
}
 
base = devm_ioremap(dev, res.start, resource_size());
-   if (!base)
+   if (!base) {
+   ret = -ENOMEM;
goto err_addr_to_resource;
+   }
 
regmap = devm_regmap_init_mmio(dev, base, _regmap_config);
if (IS_ERR(regmap)) {
@@ -859,6 +861,7 @@ static int wiz_probe(struct platform_device *pdev)
 
if (num_lanes > WIZ_MAX_LANES) {
dev_err(dev, "Cannot support %d lanes\n", num_lanes);
+   ret = -ENODEV;
goto err_addr_to_resource;
}
 
@@ -948,6 +951,7 @@ static int wiz_probe(struct platform_device *pdev)
serdes_pdev = of_platform_device_create(child_node, NULL, dev);
if (!serdes_pdev) {
dev_WARN(dev, "Unable to create SERDES platform device\n");
+   ret = -ENOMEM;
goto err_pdev_create;
}
wiz->serdes_pdev = serdes_pdev;





[PATCH -next] visorbus: fix error return code in visorchipset_init()

2020-05-06 Thread Wei Yongjun
Fix to return negative error code -ENODEV from the visor_check_channel()
error handling case instead of 0. Also change the error code to -ENOMEM
in kzalloc() error case.

Signed-off-by: Wei Yongjun 
---
 drivers/visorbus/visorchipset.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/visorbus/visorchipset.c b/drivers/visorbus/visorchipset.c
index cb1eb7e05f87..5668cad86e37 100644
--- a/drivers/visorbus/visorchipset.c
+++ b/drivers/visorbus/visorchipset.c
@@ -1561,7 +1561,7 @@ static void controlvm_periodic_work(struct work_struct 
*work)
 
 static int visorchipset_init(struct acpi_device *acpi_device)
 {
-   int err = -ENODEV;
+   int err = -ENOMEM;
struct visorchannel *controlvm_channel;
 
chipset_dev = kzalloc(sizeof(*chipset_dev), GFP_KERNEL);
@@ -1584,8 +1584,10 @@ static int visorchipset_init(struct acpi_device 
*acpi_device)
 "controlvm",
 sizeof(struct visor_controlvm_channel),
 VISOR_CONTROLVM_CHANNEL_VERSIONID,
-VISOR_CHANNEL_SIGNATURE))
+VISOR_CHANNEL_SIGNATURE)) {
+   err = -ENODEV;
goto error_delete_groups;
+   }
/* if booting in a crash kernel */
if (is_kdump_kernel())
INIT_DELAYED_WORK(_dev->periodic_controlvm_work,





[PATCH -next] soc: mediatek: Missing platform_device_unregister() on error in mtk_mmsys_probe()

2020-05-06 Thread Wei Yongjun
Add the missing platform_device_unregister() before return
from mtk_mmsys_probe() in the error handling case.

Fixes: 667c769246b0 ("soc / drm: mediatek: Fix mediatek-drm device probing")
Signed-off-by: Wei Yongjun 
---
 drivers/soc/mediatek/mtk-mmsys.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c
index 05e322c9c301..05ce4cb464b0 100644
--- a/drivers/soc/mediatek/mtk-mmsys.c
+++ b/drivers/soc/mediatek/mtk-mmsys.c
@@ -312,8 +312,10 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
 
drm = platform_device_register_data(>dev, "mediatek-drm",
PLATFORM_DEVID_AUTO, NULL, 0);
-   if (IS_ERR(drm))
+   if (IS_ERR(drm)) {
+   platform_device_unregister(clks);
return PTR_ERR(drm);
+   }
 
return 0;
 }





[PATCH -next v2] staging: kpc2000: fix error return code in kp2000_pcie_probe()

2020-05-06 Thread Wei Yongjun
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function. Also
removed var 'rv' since we can use 'err' instead.

Fixes: 7dc7967fc39a ("staging: kpc2000: add initial set of Daktronics drivers")
Signed-off-by: Wei Yongjun 
---
v1 -> v2: fix code aligns and add fixes
---
 drivers/staging/kpc2000/kpc2000/core.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000/core.c 
b/drivers/staging/kpc2000/kpc2000/core.c
index 7b00d7069e21..358d7b2f4ad1 100644
--- a/drivers/staging/kpc2000/kpc2000/core.c
+++ b/drivers/staging/kpc2000/kpc2000/core.c
@@ -298,7 +298,6 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
 {
int err = 0;
struct kp2000_device *pcard;
-   int rv;
unsigned long reg_bar_phys_addr;
unsigned long reg_bar_phys_len;
unsigned long dma_bar_phys_addr;
@@ -445,11 +444,11 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
if (err < 0)
goto err_release_dma;
 
-   rv = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
-pcard->name, pcard);
-   if (rv) {
+   err = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
+ pcard->name, pcard);
+   if (err) {
dev_err(>pdev->dev,
-   "%s: failed to request_irq: %d\n", __func__, rv);
+   "%s: failed to request_irq: %d\n", __func__, err);
goto err_disable_msi;
}





Re: [PATCH -next] staging: kpc2000: fix error return code in kp2000_pcie_probe()

2020-05-06 Thread Wei Yongjun



On 2020/5/6 20:57, Dan Carpenter wrote:
> On Wed, May 06, 2020 at 12:52:55PM +0000, Wei Yongjun wrote:
>> Fix to return a negative error code from the error handling
>> case instead of 0, as done elsewhere in this function. Also
>> removed var 'rv' since we can use 'err' instead.
>>
>> Signed-off-by: Wei Yongjun 
> 
> Also could you add a Fixes tag?  This goes all the way back to the
> original commit:
> 
> Fixes: 7dc7967fc39a ("staging: kpc2000: add initial set of Daktronics 
> drivers")
> 

Will fix both of your comments in next version, thanks.

Regards,
Wei Yongjun


[PATCH -next] staging: kpc2000: fix error return code in kp2000_pcie_probe()

2020-05-06 Thread Wei Yongjun
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function. Also
removed var 'rv' since we can use 'err' instead.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/kpc2000/kpc2000/core.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000/core.c 
b/drivers/staging/kpc2000/kpc2000/core.c
index 7b00d7069e21..14e07742dc9d 100644
--- a/drivers/staging/kpc2000/kpc2000/core.c
+++ b/drivers/staging/kpc2000/kpc2000/core.c
@@ -298,7 +298,6 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
 {
int err = 0;
struct kp2000_device *pcard;
-   int rv;
unsigned long reg_bar_phys_addr;
unsigned long reg_bar_phys_len;
unsigned long dma_bar_phys_addr;
@@ -445,11 +444,11 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
if (err < 0)
goto err_release_dma;
 
-   rv = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
+   err = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
 pcard->name, pcard);
-   if (rv) {
+   if (err) {
dev_err(>pdev->dev,
-   "%s: failed to request_irq: %d\n", __func__, rv);
+   "%s: failed to request_irq: %d\n", __func__, err);
goto err_disable_msi;
}





[PATCH -next] firmware: imx: scu: Fix possible memory leak in imx_scu_probe()

2020-05-05 Thread Wei Yongjun
'chan_name' is malloced in imx_scu_probe() and should be freed
before leaving from the error handling cases, otherwise it will
cause memory leak.

Fixes: edbee095fafb ("firmware: imx: add SCU firmware driver support")
Signed-off-by: Wei Yongjun 
---
 drivers/firmware/imx/imx-scu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/firmware/imx/imx-scu.c b/drivers/firmware/imx/imx-scu.c
index b3da2e193ad2..176ddd151375 100644
--- a/drivers/firmware/imx/imx-scu.c
+++ b/drivers/firmware/imx/imx-scu.c
@@ -314,6 +314,7 @@ static int imx_scu_probe(struct platform_device *pdev)
if (ret != -EPROBE_DEFER)
dev_err(dev, "Failed to request mbox chan %s 
ret %d\n",
chan_name, ret);
+   kfree(chan_name);
return ret;
}





[PATCH -next v2] drm/mcde: dsi: Fix return value check in mcde_dsi_bind()

2020-04-30 Thread Wei Yongjun
The of_drm_find_bridge() function returns NULL on error, it doesn't return
error pointers so this check doesn't work.

Fixes: 5fc537bfd000 ("drm/mcde: Add new driver for ST-Ericsson MCDE")
Signed-off-by: Wei Yongjun 
---
v1 - > v2: add fixes and fix the subject
---
 drivers/gpu/drm/mcde/mcde_dsi.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
index 7af5ebb0c436..e705afc08c4e 100644
--- a/drivers/gpu/drm/mcde/mcde_dsi.c
+++ b/drivers/gpu/drm/mcde/mcde_dsi.c
@@ -1073,10 +1073,9 @@ static int mcde_dsi_bind(struct device *dev, struct 
device *master,
panel = NULL;
 
bridge = of_drm_find_bridge(child);
-   if (IS_ERR(bridge)) {
-   dev_err(dev, "failed to find bridge (%ld)\n",
-   PTR_ERR(bridge));
-   return PTR_ERR(bridge);
+   if (!bridge) {
+   dev_err(dev, "failed to find bridge\n");
+   return -EINVAL;
}
}
}





[PATCH -next] drm/vboxvideo: Fix a NULL vs IS_ERR() check in vbox_hw_init()

2020-04-30 Thread Wei Yongjun
The devm_gen_pool_create() function returns ERR_PTR() on error, it
doesn't return NULL so this check doesn't work.

Fixes: 4cc9b565454b ("drm/vboxvideo: Use devm_gen_pool_create")
Signed-off-by: Wei Yongjun 
---
 drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vboxvideo/vbox_main.c 
b/drivers/gpu/drm/vboxvideo/vbox_main.c
index d68d9bad7674..c5ea880d17b2 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_main.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_main.c
@@ -123,8 +123,8 @@ int vbox_hw_init(struct vbox_private *vbox)
/* Create guest-heap mem-pool use 2^4 = 16 byte chunks */
vbox->guest_pool = devm_gen_pool_create(vbox->ddev.dev, 4, -1,
"vboxvideo-accel");
-   if (!vbox->guest_pool)
-   return -ENOMEM;
+   if (IS_ERR(vbox->guest_pool))
+   return PTR_ERR(vbox->guest_pool);
 
ret = gen_pool_add_virt(vbox->guest_pool,
(unsigned long)vbox->guest_heap,





[PATCH -next v2] mailbox: zynqmp-ipi: Fix NULL vs IS_ERR() check in zynqmp_ipi_mbox_probe()

2020-04-29 Thread Wei Yongjun
In case of error, the function devm_ioremap() returns NULL pointer not
ERR_PTR(). So we should check whether the return value of devm_ioremap()
is NULL instead of IS_ERR.

Fixes: 4981b82ba2ff ("mailbox: ZynqMP IPI mailbox controller")
Signed-off-by: Wei Yongjun 
---
v1 ->v2: fix the description and the module name in subject
---
 drivers/mailbox/zynqmp-ipi-mailbox.c | 20 
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c 
b/drivers/mailbox/zynqmp-ipi-mailbox.c
index 86887c9a349a..f9cc674ba9b7 100644
--- a/drivers/mailbox/zynqmp-ipi-mailbox.c
+++ b/drivers/mailbox/zynqmp-ipi-mailbox.c
@@ -504,10 +504,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox 
*ipi_mbox,
mchan->req_buf_size = resource_size();
mchan->req_buf = devm_ioremap(mdev, res.start,
  mchan->req_buf_size);
-   if (IS_ERR(mchan->req_buf)) {
+   if (!mchan->req_buf) {
dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
-   ret = PTR_ERR(mchan->req_buf);
-   return ret;
+   return -ENOMEM;
}
} else if (ret != -ENODEV) {
dev_err(mdev, "Unmatched resource %s, %d.\n", name, ret);
@@ -520,10 +519,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox 
*ipi_mbox,
mchan->resp_buf_size = resource_size();
mchan->resp_buf = devm_ioremap(mdev, res.start,
   mchan->resp_buf_size);
-   if (IS_ERR(mchan->resp_buf)) {
+   if (!mchan->resp_buf) {
dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
-   ret = PTR_ERR(mchan->resp_buf);
-   return ret;
+   return -ENOMEM;
}
} else if (ret != -ENODEV) {
dev_err(mdev, "Unmatched resource %s.\n", name);
@@ -543,10 +541,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox 
*ipi_mbox,
mchan->req_buf_size = resource_size();
mchan->req_buf = devm_ioremap(mdev, res.start,
  mchan->req_buf_size);
-   if (IS_ERR(mchan->req_buf)) {
+   if (!mchan->req_buf) {
dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
-   ret = PTR_ERR(mchan->req_buf);
-   return ret;
+   return -ENOMEM;
}
} else if (ret != -ENODEV) {
dev_err(mdev, "Unmatched resource %s.\n", name);
@@ -559,10 +556,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox 
*ipi_mbox,
mchan->resp_buf_size = resource_size();
mchan->resp_buf = devm_ioremap(mdev, res.start,
   mchan->resp_buf_size);
-   if (IS_ERR(mchan->resp_buf)) {
+   if (!mchan->resp_buf) {
dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
-   ret = PTR_ERR(mchan->resp_buf);
-   return ret;
+   return -ENOMEM;
}
} else if (ret != -ENODEV) {
dev_err(mdev, "Unmatched resource %s.\n", name);





[PATCH -next] mailbox: Fix NULL vs IS_ERR() check in zynqmp_ipi_mbox_probe()

2020-04-29 Thread Wei Yongjun
In case of error, the function devm_ioremap() returns NULL pointer not
ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: 4981b82ba2ff ("mailbox: ZynqMP IPI mailbox controller")
Signed-off-by: Wei Yongjun 
---
 drivers/mailbox/zynqmp-ipi-mailbox.c | 20 
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c 
b/drivers/mailbox/zynqmp-ipi-mailbox.c
index 86887c9a349a..f9cc674ba9b7 100644
--- a/drivers/mailbox/zynqmp-ipi-mailbox.c
+++ b/drivers/mailbox/zynqmp-ipi-mailbox.c
@@ -504,10 +504,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox 
*ipi_mbox,
mchan->req_buf_size = resource_size();
mchan->req_buf = devm_ioremap(mdev, res.start,
  mchan->req_buf_size);
-   if (IS_ERR(mchan->req_buf)) {
+   if (!mchan->req_buf) {
dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
-   ret = PTR_ERR(mchan->req_buf);
-   return ret;
+   return -ENOMEM;
}
} else if (ret != -ENODEV) {
dev_err(mdev, "Unmatched resource %s, %d.\n", name, ret);
@@ -520,10 +519,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox 
*ipi_mbox,
mchan->resp_buf_size = resource_size();
mchan->resp_buf = devm_ioremap(mdev, res.start,
   mchan->resp_buf_size);
-   if (IS_ERR(mchan->resp_buf)) {
+   if (!mchan->resp_buf) {
dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
-   ret = PTR_ERR(mchan->resp_buf);
-   return ret;
+   return -ENOMEM;
}
} else if (ret != -ENODEV) {
dev_err(mdev, "Unmatched resource %s.\n", name);
@@ -543,10 +541,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox 
*ipi_mbox,
mchan->req_buf_size = resource_size();
mchan->req_buf = devm_ioremap(mdev, res.start,
  mchan->req_buf_size);
-   if (IS_ERR(mchan->req_buf)) {
+   if (!mchan->req_buf) {
dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
-   ret = PTR_ERR(mchan->req_buf);
-   return ret;
+   return -ENOMEM;
}
} else if (ret != -ENODEV) {
dev_err(mdev, "Unmatched resource %s.\n", name);
@@ -559,10 +556,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox 
*ipi_mbox,
mchan->resp_buf_size = resource_size();
mchan->resp_buf = devm_ioremap(mdev, res.start,
   mchan->resp_buf_size);
-   if (IS_ERR(mchan->resp_buf)) {
+   if (!mchan->resp_buf) {
dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
-   ret = PTR_ERR(mchan->resp_buf);
-   return ret;
+   return -ENOMEM;
}
} else if (ret != -ENODEV) {
dev_err(mdev, "Unmatched resource %s.\n", name);





[PATCH -next] staging: pi433: fix error return code in pi433_probe()

2020-04-28 Thread Wei Yongjun
Fix to return negative error code -ENOMEM from cdev alloc failed error
handling case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/pi433/pi433_if.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 313d22f6210f..c8d0c63fdd1d 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -1230,6 +1230,7 @@ static int pi433_probe(struct spi_device *spi)
device->cdev = cdev_alloc();
if (!device->cdev) {
dev_dbg(device->dev, "allocation of cdev failed");
+   retval = -ENOMEM;
goto cdev_failed;
}
device->cdev->owner = THIS_MODULE;





[PATCH -next] soc: ti: knav_qmss_queue: fix error return code in knav_queue_probe()

2020-04-28 Thread Wei Yongjun
Fix to return negative error code -ENODEV from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun 
---
 drivers/soc/ti/knav_qmss_queue.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
index 37f3db6c041c..64339c9bb08e 100644
--- a/drivers/soc/ti/knav_qmss_queue.c
+++ b/drivers/soc/ti/knav_qmss_queue.c
@@ -1864,6 +1864,7 @@ static int knav_queue_probe(struct platform_device *pdev)
regions =  of_get_child_by_name(node, "descriptor-regions");
if (!regions) {
dev_err(dev, "descriptor-regions not specified\n");
+   ret = -ENODEV;
goto err;
}
ret = knav_queue_setup_regions(kdev, regions);





[PATCH -next] drm/mcde: dsi: Fix return value check in dev_err()

2020-04-28 Thread Wei Yongjun
In case of error, the function of_drm_find_bridge() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Signed-off-by: Wei Yongjun 
---
 drivers/gpu/drm/mcde/mcde_dsi.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
index 7af5ebb0c436..e705afc08c4e 100644
--- a/drivers/gpu/drm/mcde/mcde_dsi.c
+++ b/drivers/gpu/drm/mcde/mcde_dsi.c
@@ -1073,10 +1073,9 @@ static int mcde_dsi_bind(struct device *dev, struct 
device *master,
panel = NULL;
 
bridge = of_drm_find_bridge(child);
-   if (IS_ERR(bridge)) {
-   dev_err(dev, "failed to find bridge (%ld)\n",
-   PTR_ERR(bridge));
-   return PTR_ERR(bridge);
+   if (!bridge) {
+   dev_err(dev, "failed to find bridge\n");
+   return -EINVAL;
}
}
}







[PATCH -next] stm class: dummy_stm: fix error return code in dummy_stm_init()

2020-04-28 Thread Wei Yongjun
Fix to return error code -ENOMEM from the error handling case instead
of 0(ret can be overwritted to 0 in for loop).

Signed-off-by: Wei Yongjun 
---
 drivers/hwtracing/stm/dummy_stm.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/stm/dummy_stm.c 
b/drivers/hwtracing/stm/dummy_stm.c
index 38528ffdc0b3..36d32e7afb35 100644
--- a/drivers/hwtracing/stm/dummy_stm.c
+++ b/drivers/hwtracing/stm/dummy_stm.c
@@ -68,7 +68,7 @@ static int dummy_stm_link(struct stm_data *data, unsigned int 
master,
 
 static int dummy_stm_init(void)
 {
-   int i, ret = -ENOMEM;
+   int i, ret;
 
if (nr_dummies < 0 || nr_dummies > DUMMY_STM_MAX)
return -EINVAL;
@@ -80,8 +80,10 @@ static int dummy_stm_init(void)
 
for (i = 0; i < nr_dummies; i++) {
dummy_stm[i].name = kasprintf(GFP_KERNEL, "dummy_stm.%d", i);
-   if (!dummy_stm[i].name)
+   if (!dummy_stm[i].name) {
+   ret = -ENOMEM;
goto fail_unregister;
+   }
 
dummy_stm[i].sw_start   = master_min;
dummy_stm[i].sw_end = master_max;





[PATCH -next] stm class: stm_heartbeat: fix error return code

2020-04-28 Thread Wei Yongjun
Fix to return error code -ENOMEM from the error handling case instead
of 0(ret can be overwritted to 0 in for loop).

Signed-off-by: Wei Yongjun 
---
 drivers/hwtracing/stm/heartbeat.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/stm/heartbeat.c 
b/drivers/hwtracing/stm/heartbeat.c
index 3e7df1c0477f..81d7b21d31ec 100644
--- a/drivers/hwtracing/stm/heartbeat.c
+++ b/drivers/hwtracing/stm/heartbeat.c
@@ -64,7 +64,7 @@ static void stm_heartbeat_unlink(struct stm_source_data *data)
 
 static int stm_heartbeat_init(void)
 {
-   int i, ret = -ENOMEM;
+   int i, ret;
 
if (nr_devs < 0 || nr_devs > STM_HEARTBEAT_MAX)
return -EINVAL;
@@ -72,8 +72,10 @@ static int stm_heartbeat_init(void)
for (i = 0; i < nr_devs; i++) {
stm_heartbeat[i].data.name =
kasprintf(GFP_KERNEL, "heartbeat.%d", i);
-   if (!stm_heartbeat[i].data.name)
+   if (!stm_heartbeat[i].data.name) {
+   ret = -ENOMEM;
goto fail_unregister;
+   }
 
stm_heartbeat[i].data.nr_chans  = 1;
stm_heartbeat[i].data.link  = stm_heartbeat_link;







[PATCH -next] soc: ti: omap-prm: fix return value check in omap_prm_probe()

2019-10-10 Thread Wei Yongjun
In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Fixes: 3e99cb214f03 ("soc: ti: add initial PRM driver with reset control 
support")
Signed-off-by: Wei Yongjun 
---
 drivers/soc/ti/omap_prm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/ti/omap_prm.c b/drivers/soc/ti/omap_prm.c
index db47a8bceb87..96c6f777519c 100644
--- a/drivers/soc/ti/omap_prm.c
+++ b/drivers/soc/ti/omap_prm.c
@@ -375,8 +375,8 @@ static int omap_prm_probe(struct platform_device *pdev)
prm->data = data;
 
prm->base = devm_ioremap_resource(>dev, res);
-   if (!prm->base)
-   return -ENOMEM;
+   if (IS_ERR(prm->base))
+   return PTR_ERR(prm->base);
 
return omap_prm_reset_init(pdev, prm);
 }





[PATCH -next] phy: lantiq: vrx200-pcie: fix error return code in ltq_vrx200_pcie_phy_power_on()

2019-09-04 Thread Wei Yongjun
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: e52a632195bf ("phy: lantiq: vrx200-pcie: add a driver for the Lantiq 
VRX200 PCIe PHY")
Signed-off-by: Wei Yongjun 
---
 drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c 
b/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c
index 544d64a84cc0..6e457967653e 100644
--- a/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c
+++ b/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c
@@ -323,7 +323,8 @@ static int ltq_vrx200_pcie_phy_power_on(struct phy *phy)
goto err_disable_pdi_clk;
 
/* Check if we are in "startup ready" status */
-   if (ltq_vrx200_pcie_phy_wait_for_pll(phy) != 0)
+   ret = ltq_vrx200_pcie_phy_wait_for_pll(phy);
+   if (ret)
goto err_disable_phy_clk;
 
ltq_vrx200_pcie_phy_apply_workarounds(phy);





[PATCH -next] ASoC: SOF: imx8: Fix return value check in imx8_probe()

2019-08-26 Thread Wei Yongjun
In case of error, the function devm_ioremap_wc() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")
Signed-off-by: Wei Yongjun 
---
 sound/soc/sof/imx/imx8.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
index e502f584207f..263d4df35fe8 100644
--- a/sound/soc/sof/imx/imx8.c
+++ b/sound/soc/sof/imx/imx8.c
@@ -296,10 +296,10 @@ static int imx8_probe(struct snd_sof_dev *sdev)
sdev->bar[SOF_FW_BLK_TYPE_SRAM] = devm_ioremap_wc(sdev->dev, res.start,
  res.end - res.start +
  1);
-   if (IS_ERR(sdev->bar[SOF_FW_BLK_TYPE_SRAM])) {
+   if (!sdev->bar[SOF_FW_BLK_TYPE_SRAM]) {
dev_err(sdev->dev, "failed to ioremap mem 0x%x size 0x%x\n",
base, size);
-   ret = PTR_ERR(sdev->bar[SOF_FW_BLK_TYPE_SRAM]);
+   ret = -ENOMEM;
goto exit_pdev_unregister;
}
sdev->mailbox_bar = SOF_FW_BLK_TYPE_SRAM;





[PATCH -next] staging: fsl-dpaa2/ethsw: Remove useless set memory to zero use memset()

2019-08-01 Thread Wei Yongjun
The memory return by kzalloc() has already be set to zero, so remove
useless memset(0).

Signed-off-by: Wei Yongjun 
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index 4b94a01513a7..aac98ece2335 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -641,8 +641,6 @@ static int port_fdb_dump(struct sk_buff *skb, struct 
netlink_callback *cb,
if (!dma_mem)
return -ENOMEM;
 
-   memset(dma_mem, 0, fdb_dump_size);
-
fdb_dump_iova = dma_map_single(dev, dma_mem, fdb_dump_size,
   DMA_FROM_DEVICE);
if (dma_mapping_error(dev, fdb_dump_iova)) {





[PATCH -next] intel_th: msu: Fix possible memory leak in mode_store()

2019-07-31 Thread Wei Yongjun
'mode' is malloced in mode_store() and should be freed before leaving
from the error handling cases, otherwise it will cause memory leak.

Fixes: 615c164da0eb ("intel_th: msu: Introduce buffer interface")
Signed-off-by: Wei Yongjun 
---
 drivers/hwtracing/intel_th/msu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
index fc9f15f36ad4..2e7a04f566d4 100644
--- a/drivers/hwtracing/intel_th/msu.c
+++ b/drivers/hwtracing/intel_th/msu.c
@@ -1849,8 +1849,10 @@ mode_store(struct device *dev, struct device_attribute 
*attr, const char *buf,
 
mode = kstrndup(buf, len, GFP_KERNEL);
i = match_string(msc_mode, ARRAY_SIZE(msc_mode), mode);
-   if (i >= 0)
+   if (i >= 0) {
+   kfree(mode);
goto found;
+   }
 
/* Buffer sinks only work with a usable IRQ */
if (!msc->do_irq) {





[PATCH -next] ASoC: SOF: debug: fix possible memory leak in sof_dfsentry_write()

2019-07-05 Thread Wei Yongjun
'string' is malloced in sof_dfsentry_write() and should be freed
before leaving from the error handling cases, otherwise it will cause
memory leak.

Fixes: 091c12e1f50c ("ASoC: SOF: debug: add new debugfs entries for IPC flood 
test")
Signed-off-by: Wei Yongjun 
---
 sound/soc/sof/debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c
index 54bb53bfc81b..2388477a965e 100644
--- a/sound/soc/sof/debug.c
+++ b/sound/soc/sof/debug.c
@@ -162,7 +162,7 @@ static ssize_t sof_dfsentry_write(struct file *file, const 
char __user *buffer,
else
ret = kstrtoul(string, 0, _count);
if (ret < 0)
-   return ret;
+   goto out;
 
/* limit max duration/ipc count for flood test */
if (flood_duration_test) {
@@ -191,7 +191,7 @@ static ssize_t sof_dfsentry_write(struct file *file, const 
char __user *buffer,
"error: debugfs write failed to resume 
%d\n",
ret);
pm_runtime_put_noidle(sdev->dev);
-   return ret;
+   goto out;
}
 
/* flood test */





[PATCH] unicore32: dma: fix to pass correct device identity to free_irq()

2019-07-02 Thread Wei Yongjun
free_irq() expects the same device identity that was passed to
corresponding request_irq(), otherwise the IRQ is not freed.

Fixes: 10c9c10c3151 ("unicore32 core architecture: mm related: consistent 
device DMA handling")
Signed-off-by: Wei Yongjun 
---
 arch/unicore32/kernel/dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/unicore32/kernel/dma.c b/arch/unicore32/kernel/dma.c
index 7a0e2d4d6077..2b8666f8a37d 100644
--- a/arch/unicore32/kernel/dma.c
+++ b/arch/unicore32/kernel/dma.c
@@ -169,7 +169,7 @@ int __init puv3_init_dma(void)
ret = request_irq(IRQ_DMAERR, dma_err_handler, 0, "DMAERR", NULL);
if (ret) {
printk(KERN_CRIT "Can't register IRQ for DMAERR\n");
-   free_irq(IRQ_DMA, "DMA");
+   free_irq(IRQ_DMA, NULL);
return ret;
}





  1   2   3   4   5   6   7   8   9   10   >