[PATCH] soc: fsl: qe: Fix refcount leak in par_io_of_config

2022-11-28 Thread Zheng Yongjun
of_parse_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on error path.
Add missing of_node_put() to avoid refcount leak.

Fixes: 986585385131 ("[POWERPC] Add QUICC Engine (QE) infrastructure")
Signed-off-by: Zheng Yongjun 
---
 drivers/soc/fsl/qe/qe_io.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/soc/fsl/qe/qe_io.c b/drivers/soc/fsl/qe/qe_io.c
index a5e2d0e5ab51..e26836315167 100644
--- a/drivers/soc/fsl/qe/qe_io.c
+++ b/drivers/soc/fsl/qe/qe_io.c
@@ -159,11 +159,13 @@ int par_io_of_config(struct device_node *np)
pio_map = of_get_property(pio, "pio-map", _map_len);
if (pio_map == NULL) {
printk(KERN_ERR "pio-map is not set!\n");
+   of_node_put(pio);
return -1;
}
pio_map_len /= sizeof(unsigned int);
if ((pio_map_len % 6) != 0) {
printk(KERN_ERR "pio-map format wrong!\n");
+   of_node_put(pio);
return -1;
}

--
2.17.1



[PATCH -next] treewide: Remove duplicated include from tm-vmx-unavail.c

2021-03-26 Thread Zheng Yongjun
Remove duplicated include.

Reported-by: Hulk Robot 
Signed-off-by: Zheng Yongjun 
---
 tools/testing/selftests/powerpc/tm/tm-vmx-unavail.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/powerpc/tm/tm-vmx-unavail.c 
b/tools/testing/selftests/powerpc/tm/tm-vmx-unavail.c
index e2a0c07e8362..9ef37a9836ac 100644
--- a/tools/testing/selftests/powerpc/tm/tm-vmx-unavail.c
+++ b/tools/testing/selftests/powerpc/tm/tm-vmx-unavail.c
@@ -17,7 +17,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "tm.h"
 #include "utils.h"



[PATCH -next] selftests/powerpc: Remove duplicated include from tm-poison.c

2021-03-26 Thread Zheng Yongjun
Remove duplicated include.

Reported-by: Hulk Robot 
Signed-off-by: Zheng Yongjun 
---
 tools/testing/selftests/powerpc/tm/tm-poison.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/powerpc/tm/tm-poison.c 
b/tools/testing/selftests/powerpc/tm/tm-poison.c
index 29e5f26af7b9..27c083a03d1f 100644
--- a/tools/testing/selftests/powerpc/tm/tm-poison.c
+++ b/tools/testing/selftests/powerpc/tm/tm-poison.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "tm.h"
 



[PATCH v2 -next] misc: ocxl: use DEFINE_MUTEX() for mutex lock

2020-12-24 Thread Zheng Yongjun
mutex lock can be initialized automatically with DEFINE_MUTEX()
rather than explicitly calling mutex_init().

Signed-off-by: Zheng Yongjun 
---
 drivers/misc/ocxl/file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
index 4d1b44de1492..e70525eedaae 100644
--- a/drivers/misc/ocxl/file.c
+++ b/drivers/misc/ocxl/file.c
@@ -15,7 +15,7 @@
 
 static dev_t ocxl_dev;
 static struct class *ocxl_class;
-static struct mutex minors_idr_lock;
+static DEFINE_MUTEX(minors_idr_lock);
 static struct idr minors_idr;
 
 static struct ocxl_file_info *find_and_get_file_info(dev_t devno)
@@ -588,7 +588,6 @@ int ocxl_file_init(void)
 {
int rc;
 
-   mutex_init(_idr_lock);
idr_init(_idr);
 
rc = alloc_chrdev_region(_dev, 0, OCXL_NUM_MINORS, "ocxl");
-- 
2.22.0



[PATCH -next] soc: fsl: qe: Use DEFINE_SPINLOCK() for spinlock

2020-12-23 Thread Zheng Yongjun
spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Signed-off-by: Zheng Yongjun 
---
 drivers/soc/fsl/qe/qe_common.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c
index 75075591f630..111a36be6983 100644
--- a/drivers/soc/fsl/qe/qe_common.c
+++ b/drivers/soc/fsl/qe/qe_common.c
@@ -26,7 +26,7 @@
 #include 
 
 static struct gen_pool *muram_pool;
-static spinlock_t cpm_muram_lock;
+static DEFINE_SPINLOCK(cpm_muram_lock);
 static u8 __iomem *muram_vbase;
 static phys_addr_t muram_pbase;
 
@@ -54,7 +54,6 @@ int cpm_muram_init(void)
if (muram_pbase)
return 0;
 
-   spin_lock_init(_muram_lock);
np = of_find_compatible_node(NULL, NULL, "fsl,cpm-muram-data");
if (!np) {
/* try legacy bindings */
-- 
2.22.0



[PATCH -next] misc: ocxl: use DEFINE_MUTEX (and mutex_init() had been too late)

2020-12-23 Thread Zheng Yongjun
Signed-off-by: Zheng Yongjun 
---
 drivers/misc/ocxl/file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
index 4d1b44de1492..e70525eedaae 100644
--- a/drivers/misc/ocxl/file.c
+++ b/drivers/misc/ocxl/file.c
@@ -15,7 +15,7 @@
 
 static dev_t ocxl_dev;
 static struct class *ocxl_class;
-static struct mutex minors_idr_lock;
+static DEFINE_MUTEX(minors_idr_lock);
 static struct idr minors_idr;
 
 static struct ocxl_file_info *find_and_get_file_info(dev_t devno)
@@ -588,7 +588,6 @@ int ocxl_file_init(void)
 {
int rc;
 
-   mutex_init(_idr_lock);
idr_init(_idr);
 
rc = alloc_chrdev_region(_dev, 0, OCXL_NUM_MINORS, "ocxl");
-- 
2.22.0



[PATCH -next] ide/pmac: use DIV_ROUND_UP macro to do calculation

2020-12-22 Thread Zheng Yongjun
Don't open-code DIV_ROUND_UP() kernel macro.

Signed-off-by: Zheng Yongjun 
---
 drivers/ide/pmac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c
index ea0b064b5f56..6c0237af610d 100644
--- a/drivers/ide/pmac.c
+++ b/drivers/ide/pmac.c
@@ -105,8 +105,8 @@ static const char* model_name[] = {
  */
 
 /* Number of IDE_SYSCLK_NS ticks, argument is in nanoseconds */
-#define SYSCLK_TICKS(t)(((t) + IDE_SYSCLK_NS - 1) / 
IDE_SYSCLK_NS)
-#define SYSCLK_TICKS_66(t) (((t) + IDE_SYSCLK_66_NS - 1) / 
IDE_SYSCLK_66_NS)
+#define SYSCLK_TICKS(t)DIV_ROUND_UP(t, IDE_SYSCLK_NS)
+#define SYSCLK_TICKS_66(t) DIV_ROUND_UP(t, IDE_SYSCLK_66_NS)
 #define IDE_SYSCLK_NS  30  /* 33Mhz cell */
 #define IDE_SYSCLK_66_NS   15  /* 66Mhz cell */
 
-- 
2.22.0



[PATCH -next] pci/controller/dwc: convert comma to semicolon

2020-12-16 Thread Zheng Yongjun
Replace a comma between expression statements by a semicolon.

Signed-off-by: Zheng Yongjun 
---
 drivers/pci/controller/dwc/pci-layerscape-ep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pci-layerscape-ep.c 
b/drivers/pci/controller/dwc/pci-layerscape-ep.c
index 84206f265e54..917ba8d254fc 100644
--- a/drivers/pci/controller/dwc/pci-layerscape-ep.c
+++ b/drivers/pci/controller/dwc/pci-layerscape-ep.c
@@ -178,7 +178,7 @@ static int __init ls_pcie_ep_probe(struct platform_device 
*pdev)
pci->dev = dev;
pci->ops = pcie->drvdata->dw_pcie_ops;
 
-   ls_epc->bar_fixed_64bit = (1 << BAR_2) | (1 << BAR_4),
+   ls_epc->bar_fixed_64bit = (1 << BAR_2) | (1 << BAR_4);
 
pcie->pci = pci;
pcie->ls_epc = ls_epc;
-- 
2.22.0



[PATCH -next] soc: fsl: qbman: Delete useless kfree code

2020-12-16 Thread Zheng Yongjun
The parameter of kfree function is NULL, so kfree code is useless, delete it.

Signed-off-by: Zheng Yongjun 
---
 drivers/soc/fsl/qbman/bman.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/soc/fsl/qbman/bman.c b/drivers/soc/fsl/qbman/bman.c
index c5dd026fe889..6cc1847e534a 100644
--- a/drivers/soc/fsl/qbman/bman.c
+++ b/drivers/soc/fsl/qbman/bman.c
@@ -709,7 +709,6 @@ struct bman_pool *bman_new_pool(void)
return pool;
 err:
bm_release_bpid(bpid);
-   kfree(pool);
return NULL;
 }
 EXPORT_SYMBOL(bman_new_pool);
-- 
2.22.0



[PATCH -next] tty/hvc/hvsi_lib: convert comma to semicolon

2020-12-14 Thread Zheng Yongjun
Replace a comma between expression statements by a semicolon.

Signed-off-by: Zheng Yongjun 
---
 drivers/tty/hvc/hvsi_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/hvc/hvsi_lib.c b/drivers/tty/hvc/hvsi_lib.c
index 09289c8154ae..8c4ad495f819 100644
--- a/drivers/tty/hvc/hvsi_lib.c
+++ b/drivers/tty/hvc/hvsi_lib.c
@@ -301,7 +301,7 @@ int hvsilib_write_mctrl(struct hvsi_priv *pv, int dtr)
pr_devel("HVSI@%x: %s DTR...\n", pv->termno,
 dtr ? "Setting" : "Clearing");
 
-   ctrl.hdr.type = VS_CONTROL_PACKET_HEADER,
+   ctrl.hdr.type = VS_CONTROL_PACKET_HEADER;
ctrl.hdr.len = sizeof(struct hvsi_control);
ctrl.verb = cpu_to_be16(VSV_SET_MODEM_CTL);
ctrl.mask = cpu_to_be32(HVSI_TSDTR);
-- 
2.22.0



[PATCH] qbman: Remove set but not used variable 'err'

2020-04-03 Thread Zheng Yongjun
From: network 

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/soc/fsl/qbman/bman.c:640:6: warning: variable ‘err’ set but not used 
[-Wunused-but-set-variable]
  int err = 0;
  ^~~
err is never used, so remove it.

Reported-by: Hulk Robot 
Signed-off-by: Zheng Yongjun 
Signed-off-by: network 
---
 drivers/soc/fsl/qbman/bman.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/soc/fsl/qbman/bman.c b/drivers/soc/fsl/qbman/bman.c
index f4fb527..0a24433 100644
--- a/drivers/soc/fsl/qbman/bman.c
+++ b/drivers/soc/fsl/qbman/bman.c
@@ -637,7 +637,6 @@ int bman_p_irqsource_add(struct bman_portal *p, u32 bits)
 
 int bm_shutdown_pool(u32 bpid)
 {
-   int err = 0;
struct bm_mc_command *bm_cmd;
union bm_mc_result *bm_res;
 
@@ -650,7 +649,6 @@ int bm_shutdown_pool(u32 bpid)
bm_mc_commit(>p, BM_MCC_VERB_CMD_ACQUIRE | 1);
if (!bm_mc_result_timeout(>p, _res)) {
pr_crit("BMan Acquire Command timedout\n");
-   err = -ETIMEDOUT;
goto done;
}
if (!(bm_res->verb & BM_MCR_VERB_ACQUIRE_BUFCOUNT)) {
-- 
2.7.4