[PATCH] ASoC: stm32: sai: fix invalid use of sizeof in stm32_sai_add_mclk_provider()

2018-10-26 Thread Wei Yongjun
sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.

Fixes: 8307b2afd386 ("ASoC: stm32: sai: set sai as mclk clock provider")
Signed-off-by: Wei Yongjun 
---
 sound/soc/stm/stm32_sai_sub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c
index ea05cc9..211589b 100644
--- a/sound/soc/stm/stm32_sai_sub.c
+++ b/sound/soc/stm/stm32_sai_sub.c
@@ -390,7 +390,7 @@ static int stm32_sai_add_mclk_provider(struct 
stm32_sai_sub_data *sai)
char *mclk_name, *p, *s = (char *)pname;
int ret, i = 0;
 
-   mclk = devm_kzalloc(dev, sizeof(mclk), GFP_KERNEL);
+   mclk = devm_kzalloc(dev, sizeof(*mclk), GFP_KERNEL);
if (!mclk)
return -ENOMEM;





[PATCH -next] uio: make symbol 'uio_class_registered' static

2018-09-25 Thread Wei Yongjun
Fixes the following sparse warning:

drivers/uio/uio.c:277:6: warning:
 symbol 'uio_class_registered' was not declared. Should it be static?

Fixes: ae61cf5b9913 ("uio: ensure class is registered before devices")
Signed-off-by: Wei Yongjun 
---
 drivers/uio/uio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 0ffb324..d4cc07d 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -274,7 +274,7 @@ static ssize_t event_show(struct device *dev,
.dev_groups = uio_groups,
 };
 
-bool uio_class_registered;
+static bool uio_class_registered;
 
 /*
  * device functions



[PATCH -next] ANDROID: binder: make symbol 'binder_free_buf' static

2018-09-25 Thread Wei Yongjun
Fixes the following sparse warning:

drivers/android/binder.c:3312:1: warning:
 symbol 'binder_free_buf' was not declared. Should it be static?

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

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 1b54bb5..cb30a52 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -3308,7 +3308,7 @@ static void binder_transaction(struct binder_proc *proc,
  *
  * Cleanup buffer and free it.
  */
-void
+static void
 binder_free_buf(struct binder_proc *proc, struct binder_buffer *buffer)
 {
if (buffer->transaction) {



[PATCH -next] platform: goldfish: pipe: Make symbol 'goldfish_pipe_dev' static

2018-09-20 Thread Wei Yongjun
Fixes the following sparse warning:

drivers/platform/goldfish/goldfish_pipe.c:214:26: warning:
 symbol 'goldfish_pipe_dev' was not declared. Should it be static?


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

diff --git a/drivers/platform/goldfish/goldfish_pipe.c 
b/drivers/platform/goldfish/goldfish_pipe.c
index b4a484b..0f66d77 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -211,7 +211,7 @@ struct goldfish_pipe_dev {
unsigned char __iomem *base;
 };
 
-struct goldfish_pipe_dev goldfish_pipe_dev;
+static struct goldfish_pipe_dev goldfish_pipe_dev;
 
 static int goldfish_pipe_cmd_locked(struct goldfish_pipe *pipe,
enum PipeCmdCode cmd)



[PATCH -next] drm/vkms: Fix possible memory leak in _vkms_get_crc()

2018-09-14 Thread Wei Yongjun
'vaddr_out' is malloced in _vkms_get_crc() and should be freed before
leaving from the error handling cases, otherwise it will cause memory
leak.

Fixes: db7f419c06d7 ("drm/vkms: Compute CRC with Cursor Plane")
Signed-off-by: Wei Yongjun 
---
 drivers/gpu/drm/vkms/vkms_crc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c
index 0a27456..9d9e814 100644
--- a/drivers/gpu/drm/vkms/vkms_crc.c
+++ b/drivers/gpu/drm/vkms/vkms_crc.c
@@ -125,6 +125,7 @@ static uint32_t _vkms_get_crc(struct vkms_crc_data 
*primary_crc,
mutex_lock(_obj->pages_lock);
if (WARN_ON(!vkms_obj->vaddr)) {
mutex_unlock(_obj->pages_lock);
+   kfree(vaddr_out);
return crc;
}



[PATCH -next] drm/vkms: Fix the error handling in vkms_init()

2018-08-02 Thread Wei Yongjun
In the drm_vblank_init() error handling case, platform device
unregister is missing. This patch fix it.

Fixes: 3a0709928b17 ("drm/vkms: Add vblank events simulated by hrtimers")
Signed-off-by: Wei Yongjun 
---
 drivers/gpu/drm/vkms/vkms_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 6e728b8..5ad09d4 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -110,7 +110,7 @@ static int __init vkms_init(void)
ret = drm_vblank_init(_device->drm, 1);
if (ret) {
DRM_ERROR("Failed to vblank\n");
-   goto out_fini;
+   goto out_unregister;
}
 
ret = vkms_modeset_init(vkms_device);



[PATCH -next] ALSA: usb-audio: Fix invalid use of sizeof in parse_uac_endpoint_attributes()

2018-08-01 Thread Wei Yongjun
sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.

Fixes: 7edf3b5e6a45 ("ALSA: usb-audio: AudioStreaming Power Domain parsing")
Signed-off-by: Wei Yongjun 
---
 sound/usb/stream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index 8fe3b0e..67cf849 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -1037,7 +1037,7 @@ static int parse_uac_endpoint_attributes(struct 
snd_usb_audio *chip,
fp->rate_max = UAC3_BADD_SAMPLING_RATE;
fp->rates = SNDRV_PCM_RATE_CONTINUOUS;
 
-   pd = kzalloc(sizeof(pd), GFP_KERNEL);
+   pd = kzalloc(sizeof(*pd), GFP_KERNEL);
if (!pd) {
kfree(fp->rate_table);
kfree(fp);



[PATCH -next] staging: axis-fifo: fix return value check in axis_fifo_probe()

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

Fixes: 4a965c5f89de ("staging: add driver for Xilinx AXI-Stream FIFO v4.1 IP 
core")
Signed-off-by: Wei Yongjun 
---
 drivers/staging/axis-fifo/axis-fifo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/axis-fifo/axis-fifo.c 
b/drivers/staging/axis-fifo/axis-fifo.c
index 2a73302..51a081d 100644
--- a/drivers/staging/axis-fifo/axis-fifo.c
+++ b/drivers/staging/axis-fifo/axis-fifo.c
@@ -1006,10 +1006,10 @@ static int axis_fifo_probe(struct platform_device *pdev)
/* create driver file */
fifo->device = device_create(axis_fifo_driver_class, NULL, fifo->devt,
 NULL, device_name);
-   if (!fifo->device) {
+   if (IS_ERR(fifo->device)) {
dev_err(fifo->dt_device,
"couldn't create driver file\n");
-   rc = -ENOMEM;
+   rc = PTR_ERR(fifo->device);
goto err_chrdev_region;
}
dev_set_drvdata(fifo->device, fifo);



[PATCH -next] fsi: sbefifo: Fix missing unlock on error in sbefifo_dump_ffdc()

2018-07-12 Thread Wei Yongjun
Add the missing unlock before return from function sbefifo_dump_ffdc()
in the error handling case.

Fixes: 9f4a8a2d7f9d ("fsi/sbefifo: Add driver for the SBE FIFO")
Signed-off-by: Wei Yongjun 
---
 drivers/fsi/fsi-sbefifo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c
index 6b31cc24..35f2749 100644
--- a/drivers/fsi/fsi-sbefifo.c
+++ b/drivers/fsi/fsi-sbefifo.c
@@ -150,6 +150,7 @@ static void sbefifo_dump_ffdc(struct device *dev, const 
__be32 *ffdc,
u32 w0, w1, w2, i;
if (ffdc_sz < 3) {
dev_err(dev, "SBE invalid FFDC package size %zd\n", 
ffdc_sz);
+   mutex_unlock(_ffdc_mutex);
return;
}
w0 = be32_to_cpu(*(ffdc++));



[PATCH -next] misc: vexpress: Fix potential NULL dereference in vexpress_syscfg_probe()

2018-07-11 Thread Wei Yongjun
platform_get_resource() may fail and return NULL, so we should
better check it's return value to avoid a NULL pointer dereference
a bit later in the code.

This is detected by Coccinelle semantic patch.

@@
expression pdev, res, n, t, e, e1, e2;
@@

res = platform_get_resource(pdev, t, n);
+ if (!res)
+   return -EINVAL;
... when != res == NULL
e = devm_ioremap(e1, res->start, e2);

Signed-off-by: Wei Yongjun 
---
 drivers/misc/vexpress-syscfg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/misc/vexpress-syscfg.c b/drivers/misc/vexpress-syscfg.c
index 9eea30f..2d72c93 100644
--- a/drivers/misc/vexpress-syscfg.c
+++ b/drivers/misc/vexpress-syscfg.c
@@ -259,6 +259,8 @@ static int vexpress_syscfg_probe(struct platform_device 
*pdev)
INIT_LIST_HEAD(>funcs);
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (!res)
+   return -EINVAL;
if (!devm_request_mem_region(>dev, res->start,
resource_size(res), pdev->name))
return -EBUSY;





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

2018-07-11 Thread Wei Yongjun
Fix to return a negative error code from the kthread_run() 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 293602d..d4bfac1 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -1235,6 +1235,7 @@ static int pi433_probe(struct spi_device *spi)
 device->minor);
if (IS_ERR(device->tx_task_struct)) {
dev_dbg(device->dev, "start of send thread failed");
+   retval = PTR_ERR(device->tx_task_struct);
goto send_thread_failed;
}
 





[PATCH -next v3] mtd: spinand: fix missing unlock on error

2018-07-04 Thread Wei Yongjun
Add the missing unlock before return from function
spinand_mtd_(read|write) in the error handling case.

Fixes: c898e0526fb6 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Signed-off-by: Wei Yongjun 
---
v2 -> v3: remove blank line
v1 -> v2: using break instead of return
---
 drivers/mtd/nand/spi/core.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 17d207a..8998dca 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -561,11 +561,11 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t 
from,
nanddev_io_for_each_page(nand, from, ops, ) {
ret = spinand_select_target(spinand, iter.req.pos.target);
if (ret)
-   return ret;
+   break;
 
ret = spinand_ecc_enable(spinand, enable_ecc);
if (ret)
-   return ret;
+   break;
 
ret = spinand_read_page(spinand, , enable_ecc);
if (ret < 0 && ret != -EBADMSG)
@@ -609,11 +609,11 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t 
to,
nanddev_io_for_each_page(nand, to, ops, ) {
ret = spinand_select_target(spinand, iter.req.pos.target);
if (ret)
-   return ret;
+   break;
 
ret = spinand_ecc_enable(spinand, enable_ecc);
if (ret)
-   return ret;
+   break;
 
ret = spinand_write_page(spinand, );
if (ret)



[PATCH -next v2] mtd: spinand: fix missing unlock on error

2018-07-04 Thread Wei Yongjun
Add the missing unlock before return from function
spinand_mtd_(read|write) in the error handling case.

Fixes: c898e0526fb6 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Signed-off-by: Wei Yongjun 
---
v1 -> v2: using break instead of return
---
 drivers/mtd/nand/spi/core.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 17d207a..e072464 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -561,11 +561,12 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t 
from,
nanddev_io_for_each_page(nand, from, ops, ) {
ret = spinand_select_target(spinand, iter.req.pos.target);
if (ret)
-   return ret;
+   break;
 
ret = spinand_ecc_enable(spinand, enable_ecc);
if (ret)
-   return ret;
+   break;
+
 
ret = spinand_read_page(spinand, , enable_ecc);
if (ret < 0 && ret != -EBADMSG)
@@ -609,11 +610,11 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t 
to,
nanddev_io_for_each_page(nand, to, ops, ) {
ret = spinand_select_target(spinand, iter.req.pos.target);
if (ret)
-   return ret;
+   break;
 
ret = spinand_ecc_enable(spinand, enable_ecc);
if (ret)
-   return ret;
+   break;
 
ret = spinand_write_page(spinand, );
if (ret)



[PATCH -next] mtd: spinand: Fix error return code in spinand_init()

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

Fixes: c898e0526fb6 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Signed-off-by: Wei Yongjun 
---
 drivers/mtd/nand/spi/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 17d207a..011683e 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -985,8 +985,10 @@ static int spinand_init(struct spinand_device *spinand)
spinand->databuf = kzalloc(nanddev_page_size(nand) +
   nanddev_per_page_oobsize(nand),
   GFP_KERNEL);
-   if (!spinand->databuf)
+   if (!spinand->databuf) {
+   ret = -ENOMEM;
goto err_free_bufs;
+   }
 
spinand->oobbuf = spinand->databuf + nanddev_page_size(nand);



[PATCH -next] mtd: spinand: Fix missing unlock on error path

2018-07-04 Thread Wei Yongjun
Add the missing unlock before return from function
spinand_mtd_(read|write) in the error handling case.

Fixes: c898e0526fb6 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Signed-off-by: Wei Yongjun 
---
 drivers/mtd/nand/spi/core.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 17d207a..8ac1ba95 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -560,12 +560,16 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t 
from,
 
nanddev_io_for_each_page(nand, from, ops, ) {
ret = spinand_select_target(spinand, iter.req.pos.target);
-   if (ret)
+   if (ret) {
+   mutex_unlock(>lock);
return ret;
+   }
 
ret = spinand_ecc_enable(spinand, enable_ecc);
-   if (ret)
+   if (ret) {
+   mutex_unlock(>lock);
return ret;
+   }
 
ret = spinand_read_page(spinand, , enable_ecc);
if (ret < 0 && ret != -EBADMSG)
@@ -609,11 +613,11 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t 
to,
nanddev_io_for_each_page(nand, to, ops, ) {
ret = spinand_select_target(spinand, iter.req.pos.target);
if (ret)
-   return ret;
+   break;
 
ret = spinand_ecc_enable(spinand, enable_ecc);
if (ret)
-   return ret;
+   break;
 
ret = spinand_write_page(spinand, );
if (ret)



[PATCH -next] ASoC: rt5682: use devm_snd_soc_register_component()

2018-06-21 Thread Wei Yongjun
Using devm_snd_soc_register_component() and drop all of the code
related to .remove hook.

Signed-off-by: Wei Yongjun 
---
 sound/soc/codecs/rt5682.c | 11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index 61a9730..baad177 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -2630,17 +2630,11 @@ static int rt5682_i2c_probe(struct i2c_client *i2c,
 
}
 
-   return snd_soc_register_component(>dev, _component_dev_rt5682,
+   return devm_snd_soc_register_component(>dev,
+   _component_dev_rt5682,
rt5682_dai, ARRAY_SIZE(rt5682_dai));
 }
 
-static int rt5682_i2c_remove(struct i2c_client *i2c)
-{
-   snd_soc_unregister_component(>dev);
-
-   return 0;
-}
-
 static void rt5682_i2c_shutdown(struct i2c_client *client)
 {
struct rt5682_priv *rt5682 = i2c_get_clientdata(client);
@@ -2671,7 +2665,6 @@ static void rt5682_i2c_shutdown(struct i2c_client *client)
.acpi_match_table = ACPI_PTR(rt5682_acpi_match),
},
.probe = rt5682_i2c_probe,
-   .remove = rt5682_i2c_remove,
.shutdown = rt5682_i2c_shutdown,
.id_table = rt5682_i2c_id,
 };



[PATCH -next] ASoC: rt1305: use devm_snd_soc_register_component()

2018-06-21 Thread Wei Yongjun
Using devm_snd_soc_register_component() and drop all of the code
related to .remove hook.

Signed-off-by: Wei Yongjun 
---
 sound/soc/codecs/rt1305.c | 11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/sound/soc/codecs/rt1305.c b/sound/soc/codecs/rt1305.c
index 421b8fb..c4452ef 100644
--- a/sound/soc/codecs/rt1305.c
+++ b/sound/soc/codecs/rt1305.c
@@ -1150,17 +1150,11 @@ static int rt1305_i2c_probe(struct i2c_client *i2c,
rt1305_reset(rt1305->regmap);
rt1305_calibrate(rt1305);
 
-   return snd_soc_register_component(>dev, _component_dev_rt1305,
+   return devm_snd_soc_register_component(>dev,
+   _component_dev_rt1305,
rt1305_dai, ARRAY_SIZE(rt1305_dai));
 }
 
-static int rt1305_i2c_remove(struct i2c_client *i2c)
-{
-   snd_soc_unregister_component(>dev);
-
-   return 0;
-}
-
 static void rt1305_i2c_shutdown(struct i2c_client *client)
 {
struct rt1305_priv *rt1305 = i2c_get_clientdata(client);
@@ -1180,7 +1174,6 @@ static void rt1305_i2c_shutdown(struct i2c_client *client)
 #endif
},
.probe = rt1305_i2c_probe,
-   .remove   = rt1305_i2c_remove,
.shutdown = rt1305_i2c_shutdown,
.id_table = rt1305_i2c_id,
 };



[PATCH -next] mqueue: fix a typo in mq_init_ns()

2018-06-20 Thread Wei Yongjun
Fix a typo, use 'm' instead of 'ns->mq_mnt'.

Fixes: 5cd6a50ace05 ("ipc: Convert mqueue fs to fs_context")
Signed-off-by: Wei Yongjun 
---
 ipc/mqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 833b8d7..0f10221 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -1620,7 +1620,7 @@ int mq_init_ns(struct ipc_namespace *ns)
 
m = mq_create_mount(_ipc_ns);
if (IS_ERR(m))
-   return PTR_ERR(ns->mq_mnt);
+   return PTR_ERR(m);
ns->mq_mnt = m;
return 0;
 }



[PATCH -next] nvmet: fix error return code in nvmet_file_ns_enable()

2018-05-31 Thread Wei Yongjun
Fix to return error code -ENOMEM from the memory alloc fail error
handling case instead of 0, as done elsewhere in this function.

Fixes: d5eff33ee6f8 ("nvmet: add simple file backed ns support")
Signed-off-by: Wei Yongjun 
---
 drivers/nvme/target/io-cmd-file.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/target/io-cmd-file.c 
b/drivers/nvme/target/io-cmd-file.c
index ca1ccf8..e9d6ce4 100644
--- a/drivers/nvme/target/io-cmd-file.c
+++ b/drivers/nvme/target/io-cmd-file.c
@@ -49,14 +49,18 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns)
ns->bvec_cache = kmem_cache_create("nvmet-bvec",
NVMET_MAX_MPOOL_BVEC * sizeof(struct bio_vec),
0, SLAB_HWCACHE_ALIGN, NULL);
-   if (!ns->bvec_cache)
+   if (!ns->bvec_cache) {
+   ret = -ENOMEM;
goto err;
+   }
 
ns->bvec_pool = mempool_create(NVMET_MIN_MPOOL_OBJ, mempool_alloc_slab,
mempool_free_slab, ns->bvec_cache);
 
-   if (!ns->bvec_pool)
+   if (!ns->bvec_pool) {
+   ret = -ENOMEM;
goto err;
+   }
 
return ret;
 err:



[PATCH -next] nvmet: fix a typo in nvmet_file_ns_enable()

2018-05-30 Thread Wei Yongjun
Fix a typo in nvmet_file_ns_enable().

Fixes: d5eff33ee6f8 ("nvmet: add simple file backed ns support")
Signed-off-by: Wei Yongjun 
---
 drivers/nvme/target/io-cmd-file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/io-cmd-file.c 
b/drivers/nvme/target/io-cmd-file.c
index ca1ccf8..9cff553 100644
--- a/drivers/nvme/target/io-cmd-file.c
+++ b/drivers/nvme/target/io-cmd-file.c
@@ -34,7 +34,7 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns)
O_RDWR | O_LARGEFILE | O_DIRECT, 0);
if (IS_ERR(ns->file)) {
pr_err("failed to open file %s: (%ld)\n",
-   ns->device_path, PTR_ERR(ns->bdev));
+   ns->device_path, PTR_ERR(ns->file));
return PTR_ERR(ns->file);
}



[PATCH -next] misc: ibmvmc: Use GFP_ATOMIC under spin lock

2018-05-26 Thread Wei Yongjun
The function alloc_dma_buffer() is called from ibmvmc_add_buffer(),
in which a spin lock be held here, so we should use GFP_ATOMIC when
a lock is held.

Fixes: 0eca353e7ae7 ("misc: IBM Virtual Management Channel Driver (VMC)")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/misc/ibmvmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ibmvmc.c b/drivers/misc/ibmvmc.c
index fb83d13..8f82bb9 100644
--- a/drivers/misc/ibmvmc.c
+++ b/drivers/misc/ibmvmc.c
@@ -273,7 +273,7 @@ static void *alloc_dma_buffer(struct vio_dev *vdev, size_t 
size,
  dma_addr_t *dma_handle)
 {
/* allocate memory */
-   void *buffer = kzalloc(size, GFP_KERNEL);
+   void *buffer = kzalloc(size, GFP_ATOMIC);
 
if (!buffer) {
*dma_handle = 0;



[PATCH -next] slimbus: qcom: fix potential NULL dereference in qcom_slim_prg_slew()

2018-05-22 Thread Wei Yongjun
platform_get_resource() may fail and return NULL, so we should
better check it's return value to avoid a NULL pointer dereference
a bit later in the code.

This is detected by Coccinelle semantic patch.

@@
expression pdev, res, n, t, e, e1, e2;
@@

res = platform_get_resource_byname(pdev, t, n);
+ if (!res)
+   return -EINVAL;
... when != res == NULL
e = devm_ioremap(e1, res->start, e2);

Fixes: ad7fcbc308b0 ("slimbus: qcom: Add Qualcomm Slimbus controller driver")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/slimbus/qcom-ctrl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c
index bb36a8f..caea3b9 100644
--- a/drivers/slimbus/qcom-ctrl.c
+++ b/drivers/slimbus/qcom-ctrl.c
@@ -478,6 +478,8 @@ static void qcom_slim_prg_slew(struct platform_device *pdev,
/* SLEW RATE register for this SLIMbus */
slew_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"slew");
+   if (!slew_mem)
+   return;
ctrl->slew_reg = devm_ioremap(>dev, slew_mem->start,
resource_size(slew_mem));
if (!ctrl->slew_reg)



[tip:efi/core] efi/libstub/tpm: Make function efi_retrieve_tpm2_eventlog_1_2() static

2018-05-14 Thread tip-bot for Wei Yongjun
Commit-ID:  0add16c13f49bda5455d9418d479d6c89f7ab272
Gitweb: https://git.kernel.org/tip/0add16c13f49bda5455d9418d479d6c89f7ab272
Author: Wei Yongjun <weiyongj...@huawei.com>
AuthorDate: Fri, 4 May 2018 07:59:57 +0200
Committer:  Ingo Molnar <mi...@kernel.org>
CommitDate: Mon, 14 May 2018 08:57:48 +0200

efi/libstub/tpm: Make function efi_retrieve_tpm2_eventlog_1_2() static

Fixes the following sparse warning:

drivers/firmware/efi/libstub/tpm.c:62:6: warning:
 symbol 'efi_retrieve_tpm2_eventlog_1_2' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
Reviewed-by: Jarkko Sakkinen <jarkko.sakki...@linux.intel.com>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: Matt Fleming <m...@codeblueprint.co.uk>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: linux-...@vger.kernel.org
Link: http://lkml.kernel.org/r/20180504060003.19618-12-ard.biesheu...@linaro.org
Signed-off-by: Ingo Molnar <mi...@kernel.org>
---
 drivers/firmware/efi/libstub/tpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/libstub/tpm.c 
b/drivers/firmware/efi/libstub/tpm.c
index 9d08cea3f1b0..caa37a6dd9d4 100644
--- a/drivers/firmware/efi/libstub/tpm.c
+++ b/drivers/firmware/efi/libstub/tpm.c
@@ -59,7 +59,7 @@ void efi_enable_reset_attack_mitigation(efi_system_table_t 
*sys_table_arg)
 
 #endif
 
-void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg)
+static void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg)
 {
efi_guid_t tcg2_guid = EFI_TCG2_PROTOCOL_GUID;
efi_guid_t linux_eventlog_guid = LINUX_EFI_TPM_EVENT_LOG_GUID;


[PATCH -next] ASoC: fix return value check in mt6351_codec_driver_probe()

2018-05-06 Thread 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.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 sound/soc/codecs/mt6351.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/mt6351.c b/sound/soc/codecs/mt6351.c
index e739f07..f73dcd7 100644
--- a/sound/soc/codecs/mt6351.c
+++ b/sound/soc/codecs/mt6351.c
@@ -1472,8 +1472,8 @@ static int mt6351_codec_driver_probe(struct 
platform_device *pdev)
priv->dev = >dev;
 
priv->regmap = dev_get_regmap(pdev->dev.parent, NULL);
-   if (IS_ERR(priv->regmap))
-   return PTR_ERR(priv->regmap);
+   if (!priv->regmap)
+   return -ENODEV;
 
dev_dbg(priv->dev, "%s(), dev name %s\n",
__func__, dev_name(>dev));





[PATCH -next] m68k: fix return value check in mcf_pci_init()

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

Fixes: bf114d773167 ("m68k: force use of __raw_read/__raw_write address to be 
iomem")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 arch/m68k/coldfire/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index 9d6342c..a7c2332 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -218,7 +218,7 @@ static int __init mcf_pci_init(void)
 
/* Keep a virtual mapping to IO/config space active */
iospace = ioremap(PCI_IO_PA, PCI_IO_SIZE);
-   if (IS_ERR(iospace))
+   if (!iospace)
return -ENODEV;
pr_info("Coldfire: PCI IO/config window mapped to 0x%p\n", iospace);



[PATCH -next] drm/amdkfd: Make function kfd_dev_is_large_bar() static

2018-03-29 Thread Wei Yongjun
Fixes the following sparse warning:

drivers/gpu/drm/amd/amdkfd/kfd_chardev.c:1150:6: warning:
 symbol 'kfd_dev_is_large_bar' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index cd679cf..fb5d997 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1147,7 +1147,7 @@ static int kfd_ioctl_acquire_vm(struct file *filep, 
struct kfd_process *p,
return ret;
 }
 
-bool kfd_dev_is_large_bar(struct kfd_dev *dev)
+static bool kfd_dev_is_large_bar(struct kfd_dev *dev)
 {
struct kfd_local_mem_info mem_info;



[PATCH -next] drm/amdkfd: Fix the error return code in kfd_ioctl_unmap_memory_from_gpu()

2018-03-29 Thread Wei Yongjun
Passing NULL pointer to PTR_ERR will result in return value of 0
indicating success which is clearly not what it is intended here.
This patch returns -EINVAL instead.

Fixes: 5ec7e02854b3 ("drm/amdkfd: Add ioctls for GPUVM memory management")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index cd679cf..c32a341 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1421,7 +1421,7 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file 
*filep,
 
pdd = kfd_get_process_device_data(dev, p);
if (!pdd) {
-   err = PTR_ERR(pdd);
+   err = -EINVAL;
goto bind_process_to_device_failed;
}



[PATCH -next] ASoC: amd: acp-da7219-max98357: Make symbol da7219_dai_clk static

2018-03-28 Thread Wei Yongjun
Fixes the following sparse warning:

sound/soc/amd/acp-da7219-max98357a.c:46:12: warning:
 symbol 'da7219_dai_clk' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 sound/soc/amd/acp-da7219-max98357a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/amd/acp-da7219-max98357a.c 
b/sound/soc/amd/acp-da7219-max98357a.c
index b205c78..f41560e 100644
--- a/sound/soc/amd/acp-da7219-max98357a.c
+++ b/sound/soc/amd/acp-da7219-max98357a.c
@@ -43,7 +43,7 @@
 #define DUAL_CHANNEL   2
 
 static struct snd_soc_jack cz_jack;
-struct clk *da7219_dai_clk;
+static struct clk *da7219_dai_clk;
 
 static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
 {



[PATCH -next] drm/amdgpu: fix error return code in amdgpu_amdkfd_gpuvm_create_process_vm()

2018-03-28 Thread Wei Yongjun
Fix to return error code -ENOMEM from the eviction fence create fail
error handling case instead of 0, as done elsewhere in this function.

Fixes: a46a2cd103a8 ("drm/amdgpu: Add GPUVM memory management functions for 
KFD")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index a12a165..c5c9c6f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -846,6 +846,7 @@ int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev 
*kgd, void **vm,
   current->mm);
if (!info->eviction_fence) {
pr_err("Failed to create eviction fence\n");
+   ret = -ENOMEM;
goto create_evict_fence_fail;
}



[PATCH -next] bus: fsl-mc: Remove duplicated includes

2018-03-28 Thread Wei Yongjun
Remove duplicated include.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/bus/fsl-mc/dpbp.c | 1 -
 drivers/bus/fsl-mc/dpcon.c | 1 -
 2 file changed, 2 deletion(-)

diff --git a/drivers/bus/fsl-mc/dpbp.c b/drivers/bus/fsl-mc/dpbp.c
index 0aeacc5..9a7faab 100644
--- a/drivers/bus/fsl-mc/dpbp.c
+++ b/drivers/bus/fsl-mc/dpbp.c
@@ -5,7 +5,6 @@
  */
 #include 
 #include 
-#include 
 
 #include "fsl-mc-private.h"
 
diff --git a/drivers/bus/fsl-mc/dpcon.c b/drivers/bus/fsl-mc/dpcon.c
index a1ba819..b5c968d 100644
--- a/drivers/bus/fsl-mc/dpcon.c
+++ b/drivers/bus/fsl-mc/dpcon.c
@@ -5,7 +5,6 @@
  */
 #include 
 #include 
-#include 
 
 #include "fsl-mc-private.h"



[PATCH -next] dm verity: make some functions static

2018-03-28 Thread Wei Yongjun
Fixes the following sparse warnings:

drivers/md/dm-verity-target.c:375:6: warning:
 symbol 'verity_for_io_block' was not declared. Should it be static?
drivers/md/dm-verity-target.c:403:14: warning:
 symbol 'verity_calc_buffs_for_bv' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/md/dm-verity-target.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
index da35f0e..e70d4d2 100644
--- a/drivers/md/dm-verity-target.c
+++ b/drivers/md/dm-verity-target.c
@@ -372,9 +372,9 @@ int verity_hash_for_block(struct dm_verity *v, struct 
dm_verity_io *io,
 /*
  * Calculates the digest for the given bio
  */
-void verity_for_io_block(struct dm_verity *v, struct dm_verity_io *io,
-struct bvec_iter *iter, struct scatterlist *sg,
-unsigned int *nents, unsigned int *total_len)
+static void verity_for_io_block(struct dm_verity *v, struct dm_verity_io *io,
+   struct bvec_iter *iter, struct scatterlist *sg,
+   unsigned int *nents, unsigned int *total_len)
 {
unsigned int todo = 1 << v->data_dev_block_bits;
struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size);
@@ -400,8 +400,9 @@ void verity_for_io_block(struct dm_verity *v, struct 
dm_verity_io *io,
  * Calculate how many buffers are required to accommodate
  * bio_vec starting from iter.
  */
-unsigned int verity_calc_buffs_for_bv(struct dm_verity *v, struct dm_verity_io 
*io,
- struct bvec_iter *iter)
+static unsigned int verity_calc_buffs_for_bv(struct dm_verity *v,
+struct dm_verity_io *io,
+struct bvec_iter *iter)
 {
unsigned int todo = 1 << v->data_dev_block_bits;
struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size);



[PATCH -next] powerpc: Fix error return code in ppc4xx_msi_probe()

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

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 arch/powerpc/platforms/4xx/msi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/4xx/msi.c b/arch/powerpc/platforms/4xx/msi.c
index 4b859c8..0b71c52 100644
--- a/arch/powerpc/platforms/4xx/msi.c
+++ b/arch/powerpc/platforms/4xx/msi.c
@@ -241,7 +241,8 @@ static int ppc4xx_msi_probe(struct platform_device *dev)
if (!msi_irqs)
return -ENODEV;
 
-   if (ppc4xx_setup_pcieh_hw(dev, res, msi))
+   err = ppc4xx_setup_pcieh_hw(dev, res, msi)
+   if (err)
goto error_out;
 
err = ppc4xx_msi_init_allocator(dev, msi);





[PATCH -next] afs: Make symbol 'afs_cell_gc_delay' static

2018-03-26 Thread Wei Yongjun
Fixes the following sparse warnings:

fs/afs/cell.c:21:24: warning:
 symbol 'afs_cell_gc_delay' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 fs/afs/cell.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index 3d2c5e0..c17e03b 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -18,7 +18,7 @@
 #include 
 #include "internal.h"
 
-unsigned __read_mostly afs_cell_gc_delay = 10;
+static unsigned __read_mostly afs_cell_gc_delay = 10;
 
 static void afs_manage_cell(struct work_struct *);



[PATCH -next] staging: mt7621-eth: fix return value check in mt7621_gsw_probe()

2018-03-21 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: f079b6406348 ("staging: mt7621-eth: add gigabit switch driver (GSW)")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/staging/mt7621-eth/gsw_mt7621.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/mt7621-eth/gsw_mt7621.c 
b/drivers/staging/mt7621-eth/gsw_mt7621.c
index b49ee94..ce8d7d7 100644
--- a/drivers/staging/mt7621-eth/gsw_mt7621.c
+++ b/drivers/staging/mt7621-eth/gsw_mt7621.c
@@ -263,8 +263,8 @@ static int mt7621_gsw_probe(struct platform_device *pdev)
return -ENOMEM;
 
gsw->base = devm_ioremap_resource(>dev, res);
-   if (!gsw->base)
-   return -EADDRNOTAVAIL;
+   if (IS_ERR(gsw->base))
+   return PTR_ERR(gsw->base);
 
gsw->dev = >dev;
gsw->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);



[PATCH -next] staging: mt7621-eth: fix return value check in mtk_probe()

2018-03-21 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: e3cbf478f846 ("staging: mt7621-eth: add the drivers core files")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/staging/mt7621-eth/mtk_eth_soc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/mt7621-eth/mtk_eth_soc.c 
b/drivers/staging/mt7621-eth/mtk_eth_soc.c
index 98b4462..dea4270 100644
--- a/drivers/staging/mt7621-eth/mtk_eth_soc.c
+++ b/drivers/staging/mt7621-eth/mtk_eth_soc.c
@@ -2077,8 +2077,8 @@ static int mtk_probe(struct platform_device *pdev)
return -ENOMEM;
 
eth->base = devm_ioremap_resource(>dev, res);
-   if (!eth->base)
-   return -EADDRNOTAVAIL;
+   if (IS_ERR(eth->base))
+   return PTR_ERR(eth->base);
 
spin_lock_init(>page_lock);



[PATCH -next] staging: mt7621-eth: fix return value check in mtk_connect_phy_node()

2018-03-21 Thread Wei Yongjun
In case of error, the function of_phy_connect() returns NULL pointer not
ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: e3cbf478f846 ("staging: mt7621-eth: add the drivers core files")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/staging/mt7621-eth/mdio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/mt7621-eth/mdio.c 
b/drivers/staging/mt7621-eth/mdio.c
index 96ecda9..9d71307 100644
--- a/drivers/staging/mt7621-eth/mdio.c
+++ b/drivers/staging/mt7621-eth/mdio.c
@@ -82,10 +82,10 @@ int mtk_connect_phy_node(struct mtk_eth *eth, struct 
mtk_mac *mac,
 
phydev = of_phy_connect(eth->netdev[mac->id], phy_node,
mtk_phy_link_adjust, 0, phy_mode);
-   if (IS_ERR(phydev)) {
+   if (!phydev) {
dev_err(eth->dev, "could not connect to PHY\n");
eth->phy->phy_node[port] = NULL;
-   return PTR_ERR(phydev);
+   return -ENODEV;
}
 
phydev->supported &= PHY_GBIT_FEATURES;



[PATCH -next] staging: mt7621-gpio: mt7621: make symbol gc_map static

2018-03-21 Thread Wei Yongjun
Fixes the following sparse warning:

drivers/staging/mt7621-gpio/gpio-mt7621.c:47:3: warning:
 symbol 'gc_map' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/staging/mt7621-gpio/gpio-mt7621.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index 5c57abe..d00c1cd 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -38,7 +38,7 @@ enum mediatek_gpio_reg {
 static int mediatek_gpio_irq;
 static struct irq_domain *mediatek_gpio_irq_domain;
 
-struct mtk_gc {
+static struct mtk_gc {
struct gpio_chip chip;
spinlock_t lock;
int bank;



[PATCH -next] drm/meson: Fix potential NULL dereference in meson_drv_bind_master()

2018-03-20 Thread Wei Yongjun
platform_get_resource_byname() may fail and return NULL, so we should
better check it's return value to avoid a NULL pointer dereference
a bit later in the code.

This is detected by Coccinelle semantic patch.

@@
expression pdev, res, n, t, e, e1, e2;
@@

res = platform_get_resource_byname(pdev, t, n);
+ if (!res)
+   return -EINVAL;
... when != res == NULL
e = devm_ioremap(e1, res->start, e2);

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/gpu/drm/meson/meson_drv.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/meson/meson_drv.c 
b/drivers/gpu/drm/meson/meson_drv.c
index 3baceb7..32b1a6c 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -197,6 +197,8 @@ static int meson_drv_bind_master(struct device *dev, bool 
has_components)
priv->io_base = regs;
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hhi");
+   if (!res)
+   return -EINVAL;
/* Simply ioremap since it may be a shared register zone */
regs = devm_ioremap(dev, res->start, resource_size(res));
if (!regs) {
@@ -213,6 +215,8 @@ static int meson_drv_bind_master(struct device *dev, bool 
has_components)
}
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmc");
+   if (!res)
+   return -EINVAL;
/* Simply ioremap since it may be a shared register zone */
regs = devm_ioremap(dev, res->start, resource_size(res));
if (!regs) {



[PATCH -next] phy: stm32: fix using 0 as NULL pointer warnings

2018-03-20 Thread Wei Yongjun
Fixes the following sparse warnings:

drivers/phy/st/phy-stm32-usbphyc.c:331:42: warning:
 Using plain integer as NULL pointer
drivers/phy/st/phy-stm32-usbphyc.c:344:52: warning:
 Using plain integer as NULL pointer

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/phy/st/phy-stm32-usbphyc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/st/phy-stm32-usbphyc.c 
b/drivers/phy/st/phy-stm32-usbphyc.c
index bc4e78a..48d4086 100644
--- a/drivers/phy/st/phy-stm32-usbphyc.c
+++ b/drivers/phy/st/phy-stm32-usbphyc.c
@@ -328,7 +328,7 @@ static int stm32_usbphyc_probe(struct platform_device *pdev)
if (IS_ERR(usbphyc->base))
return PTR_ERR(usbphyc->base);
 
-   usbphyc->clk = devm_clk_get(dev, 0);
+   usbphyc->clk = devm_clk_get(dev, NULL);
if (IS_ERR(usbphyc->clk)) {
ret = PTR_ERR(usbphyc->clk);
dev_err(dev, "clk get failed: %d\n", ret);
@@ -341,7 +341,7 @@ static int stm32_usbphyc_probe(struct platform_device *pdev)
return ret;
}
 
-   usbphyc->rst = devm_reset_control_get(dev, 0);
+   usbphyc->rst = devm_reset_control_get(dev, NULL);
if (!IS_ERR(usbphyc->rst)) {
reset_control_assert(usbphyc->rst);
udelay(2);



[PATCH -next] phy: phy-mtk-tphy: fix missing clk_disable_unprepare() on error in mtk_phy_init()

2018-03-20 Thread Wei Yongjun
Fix the missing clk_disable_unprepare() before return
from mtk_phy_init() in the error handling case.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c 
b/drivers/phy/mediatek/phy-mtk-tphy.c
index 38c281b..3ff9020 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -841,7 +841,7 @@ static int mtk_phy_init(struct phy *phy)
ret = clk_prepare_enable(instance->ref_clk);
if (ret) {
dev_err(tphy->dev, "failed to enable ref_clk\n");
-   return ret;
+   goto disable_u3phya_ref;
}
 
switch (instance->type) {
@@ -859,10 +859,17 @@ static int mtk_phy_init(struct phy *phy)
break;
default:
dev_err(tphy->dev, "incompatible PHY type\n");
-   return -EINVAL;
+   ret = -EINVAL;
+   goto disable_ref_clk;
}
 
return 0;
+
+disable_ref_clk:
+   clk_disable_unprepare(instance->ref_clk);
+disable_u3phya_ref:
+   clk_disable_unprepare(tphy->u3phya_ref);
+   return ret;
 }
 
 static int mtk_phy_power_on(struct phy *phy)





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

2018-03-16 Thread Wei Yongjun
Since the remove callback is removed, the snd_soc_unregister_component()
is missing when remove device. Using devm_snd_soc_register_component()
instead of snd_soc_register_component().

Fixes: 10dc44c6462d ("ASoC: wm8400: replace codec to component")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 sound/soc/codecs/wm8400.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
index c237365..57b2206 100644
--- a/sound/soc/codecs/wm8400.c
+++ b/sound/soc/codecs/wm8400.c
@@ -1343,7 +1343,7 @@ static void  wm8400_component_remove(struct 
snd_soc_component *component)
 
 static int wm8400_probe(struct platform_device *pdev)
 {
-   return snd_soc_register_component(>dev,
+   return devm_snd_soc_register_component(>dev,
_component_dev_wm8400,
_dai, 1);
 }



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

2018-03-16 Thread Wei Yongjun
Since the remove callback is removed, the snd_soc_unregister_component()
is missing when remove device. Using devm_snd_soc_register_component()
instead of snd_soc_register_component().

Fixes: d06f33aed85c ("ASoC: da7210: replace codec to component")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 sound/soc/codecs/da7210.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
index 07153be..a664111 100644
--- a/sound/soc/codecs/da7210.c
+++ b/sound/soc/codecs/da7210.c
@@ -1233,7 +1233,7 @@ static int da7210_i2c_probe(struct i2c_client *i2c,
if (ret != 0)
dev_warn(>dev, "Failed to apply regmap patch: %d\n", ret);
 
-   ret =  snd_soc_register_component(>dev,
+   ret =  devm_snd_soc_register_component(>dev,
_component_dev_da7210, _dai, 1);
if (ret < 0)
dev_err(>dev, "Failed to register component: %d\n", ret);



[PATCH -next] ASoC: mediatek: mt2701: drop unnessary snd_soc_unregister_component()

2018-03-16 Thread Wei Yongjun
It's not necessary to unregister a component registered
with devm_snd_soc_register_component().

Fixes: f1b5bf07365d ("ASoC: mt2701/mt8173: replace platform to componen")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c 
b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
index f7e0702..43837a3 100644
--- a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
+++ b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
@@ -1561,8 +1561,6 @@ static int mt2701_afe_pcm_dev_remove(struct 
platform_device *pdev)
if (!pm_runtime_status_suspended(>dev))
mt2701_afe_runtime_suspend(>dev);
 
-   snd_soc_unregister_component(>dev);
-
return 0;
 }



[PATCH -next] mtd: ubi: wl: Fix error return code in ubi_wl_init()

2018-01-18 Thread Wei Yongjun
Fix to return error code -ENOMEM from the kmem_cache_alloc() error
handling case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/mtd/ubi/wl.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 77ab49f..2052a64 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1617,8 +1617,10 @@ int ubi_wl_init(struct ubi_device *ubi, struct 
ubi_attach_info *ai)
cond_resched();
 
e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
-   if (!e)
+   if (!e) {
+   err = -ENOMEM;
goto out_free;
+   }
 
e->pnum = aeb->pnum;
e->ec = aeb->ec;
@@ -1637,8 +1639,10 @@ int ubi_wl_init(struct ubi_device *ubi, struct 
ubi_attach_info *ai)
cond_resched();
 
e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
-   if (!e)
+   if (!e) {
+   err = -ENOMEM;
goto out_free;
+   }
 
e->pnum = aeb->pnum;
e->ec = aeb->ec;



[PATCH -next v2] ipmi/powernv: Fix error return code in ipmi_powernv_probe()

2018-01-17 Thread Wei Yongjun
Fix to return a negative error code from the request_irq() error
handling case instead of 0, as done elsewhere in this function.

Fixes: dce143c3381c ("ipmi/powernv: Convert to irq event interface")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
v1 -> v2: add fixes.
---
 drivers/char/ipmi/ipmi_powernv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_powernv.c b/drivers/char/ipmi/ipmi_powernv.c
index c687c8d..bcf493d 100644
--- a/drivers/char/ipmi/ipmi_powernv.c
+++ b/drivers/char/ipmi/ipmi_powernv.c
@@ -250,8 +250,9 @@ static int ipmi_powernv_probe(struct platform_device *pdev)
ipmi->irq = opal_event_request(prop);
}
 
-   if (request_irq(ipmi->irq, ipmi_opal_event, IRQ_TYPE_LEVEL_HIGH,
-   "opal-ipmi", ipmi)) {
+   rc = request_irq(ipmi->irq, ipmi_opal_event, IRQ_TYPE_LEVEL_HIGH,
+"opal-ipmi", ipmi);
+   if (rc) {
dev_warn(dev, "Unable to request irq\n");
goto err_dispose;
}



[PATCH -next] slimbus: qcom: remove redundant dev_err call in qcom_slim_probe()

2018-01-17 Thread Wei Yongjun
There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/slimbus/qcom-ctrl.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c
index ffb46f9..2f671dd 100644
--- a/drivers/slimbus/qcom-ctrl.c
+++ b/drivers/slimbus/qcom-ctrl.c
@@ -529,10 +529,8 @@ static int qcom_slim_probe(struct platform_device *pdev)
 
slim_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl");
ctrl->base = devm_ioremap_resource(ctrl->dev, slim_mem);
-   if (IS_ERR(ctrl->base)) {
-   dev_err(>dev, "IOremap failed\n");
+   if (IS_ERR(ctrl->base))
return PTR_ERR(ctrl->base);
-   }
 
sctrl->set_laddr = qcom_set_laddr;
sctrl->xfer_msg = qcom_xfer_msg;





[PATCH -next] memory: ti-emif-sram: remove redundant dev_err call in ti_emif_probe()

2018-01-17 Thread Wei Yongjun
There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/memory/ti-emif-pm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/memory/ti-emif-pm.c b/drivers/memory/ti-emif-pm.c
index 4ea1514..48cec4f 100644
--- a/drivers/memory/ti-emif-pm.c
+++ b/drivers/memory/ti-emif-pm.c
@@ -271,7 +271,6 @@ static int ti_emif_probe(struct platform_device *pdev)
emif_data->pm_data.ti_emif_base_addr_virt = devm_ioremap_resource(dev,
  res);
if (IS_ERR(emif_data->pm_data.ti_emif_base_addr_virt)) {
-   dev_err(dev, "could not ioremap emif mem\n");
ret = PTR_ERR(emif_data->pm_data.ti_emif_base_addr_virt);
return ret;
}





[PATCH -next] phy: usb: phy-brcm-usb: Remove redundant return value check of platform_get_resource()

2018-01-17 Thread Wei Yongjun
Remove unneeded error handling on the result of a call
to platform_get_resource() when the value is passed to
devm_ioremap_resource().

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/phy/broadcom/phy-brcm-usb.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/phy/broadcom/phy-brcm-usb.c 
b/drivers/phy/broadcom/phy-brcm-usb.c
index 195b981..9f01ebe 100644
--- a/drivers/phy/broadcom/phy-brcm-usb.c
+++ b/drivers/phy/broadcom/phy-brcm-usb.c
@@ -307,10 +307,6 @@ static int brcm_usb_phy_probe(struct platform_device *pdev)
dev_dbg(dev, "Best mapping table is for %s\n",
priv->ini.family_name);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res) {
-   dev_err(dev, "can't get USB_CTRL base address\n");
-   return -EINVAL;
-   }
priv->ini.ctrl_regs = devm_ioremap_resource(dev, res);
if (IS_ERR(priv->ini.ctrl_regs)) {
dev_err(dev, "can't map CTRL register space\n");



[PATCH -next] perf: hisi: Remove redundant dev_err call

2018-01-17 Thread Wei Yongjun
There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | 4 +---
 drivers/perf/hisilicon/hisi_uncore_hha_pmu.c | 4 +---
 drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c | 4 +---
 3 file changed, 3 insertion(+), 9 deletions(-)

diff --git a/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c 
b/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c
index 1b10ea0..deb11d2 100644
--- a/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c
+++ b/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c
@@ -270,10 +270,8 @@ static int hisi_ddrc_pmu_init_data(struct platform_device 
*pdev,
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
ddrc_pmu->base = devm_ioremap_resource(>dev, res);
-   if (IS_ERR(ddrc_pmu->base)) {
-   dev_err(>dev, "ioremap failed for ddrc_pmu resource\n");
+   if (IS_ERR(ddrc_pmu->base))
return PTR_ERR(ddrc_pmu->base);
-   }
 
return 0;
 }
diff --git a/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c 
b/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c
index 443906e..dbf7629 100644
--- a/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c
+++ b/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c
@@ -263,10 +263,8 @@ static int hisi_hha_pmu_init_data(struct platform_device 
*pdev,
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
hha_pmu->base = devm_ioremap_resource(>dev, res);
-   if (IS_ERR(hha_pmu->base)) {
-   dev_err(>dev, "ioremap failed for hha_pmu resource\n");
+   if (IS_ERR(hha_pmu->base))
return PTR_ERR(hha_pmu->base);
-   }
 
return 0;
 }
diff --git a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c 
b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
index 0bde5d9..8d79d88 100644
--- a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
+++ b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
@@ -266,10 +266,8 @@ static int hisi_l3c_pmu_init_data(struct platform_device 
*pdev,
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
l3c_pmu->base = devm_ioremap_resource(>dev, res);
-   if (IS_ERR(l3c_pmu->base)) {
-   dev_err(>dev, "ioremap failed for l3c_pmu resource\n");
+   if (IS_ERR(l3c_pmu->base))
return PTR_ERR(l3c_pmu->base);
-   }
 
return 0;
 }



[PATCH -next] ipmi/powernv: Fix error return code in ipmi_powernv_probe()

2018-01-17 Thread Wei Yongjun
Fix to return a negative error code from the request_irq() error
handling case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/char/ipmi/ipmi_powernv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_powernv.c b/drivers/char/ipmi/ipmi_powernv.c
index c687c8d..bcf493d 100644
--- a/drivers/char/ipmi/ipmi_powernv.c
+++ b/drivers/char/ipmi/ipmi_powernv.c
@@ -250,8 +250,9 @@ static int ipmi_powernv_probe(struct platform_device *pdev)
ipmi->irq = opal_event_request(prop);
}
 
-   if (request_irq(ipmi->irq, ipmi_opal_event, IRQ_TYPE_LEVEL_HIGH,
-   "opal-ipmi", ipmi)) {
+   rc = request_irq(ipmi->irq, ipmi_opal_event, IRQ_TYPE_LEVEL_HIGH,
+"opal-ipmi", ipmi);
+   if (rc) {
dev_warn(dev, "Unable to request irq\n");
goto err_dispose;
}



[PATCH -next] mtd: onenand: omap2: Remove redundant dev_err call in omap2_onenand_probe()

2018-01-17 Thread Wei Yongjun
There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/mtd/onenand/omap2.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index a4a2159..87c34f6 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -532,10 +532,8 @@ static int omap2_onenand_probe(struct platform_device 
*pdev)
c->phys_base = res->start;
 
c->onenand.base = devm_ioremap_resource(dev, res);
-   if (IS_ERR(c->onenand.base)) {
-   dev_err(dev, "Cannot reserve memory region %pR\n", res);
+   if (IS_ERR(c->onenand.base))
return PTR_ERR(c->onenand.base);
-   }
 
c->int_gpiod = devm_gpiod_get_optional(dev, "int", GPIOD_IN);
if (IS_ERR(c->int_gpiod)) {





[PATCH -next] dm crypt: fix error return code in crypt_ctr()

2018-01-17 Thread Wei Yongjun
Fix to return error code -ENOMEM from the mempool_create_kmalloc_pool()
error handling case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/md/dm-crypt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 9fc12f5..45f3acf 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -2740,6 +2740,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int 
argc, char **argv)
cc->tag_pool_max_sectors * cc->on_disk_tag_size);
if (!cc->tag_pool) {
ti->error = "Cannot allocate integrity tags mempool";
+   ret = -ENOMEM;
goto bad;
}



[PATCH -next] firmware: arm_sdei: Fix return value check in sdei_present_dt()

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

Fixes: 677a60bd2003 ("firmware: arm_sdei: Discover SDEI support via ACPI")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/firmware/arm_sdei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
index 8f6563c..1ea7164 100644
--- a/drivers/firmware/arm_sdei.c
+++ b/drivers/firmware/arm_sdei.c
@@ -1023,7 +1023,7 @@ static bool __init sdei_present_dt(void)
 
pdev = of_platform_device_create(np, sdei_driver.driver.name, NULL);
of_node_put(np);
-   if (IS_ERR(pdev))
+   if (!pdev)
return false;
 
return true;



[PATCH -next] drm/etnaviv: make local symbols static

2018-01-11 Thread Wei Yongjun
Fixes the following sparse warnings:

drivers/gpu/drm/etnaviv/etnaviv_iommu.c:161:39: warning:
 symbol 'etnaviv_iommuv1_ops' was not declared. Should it be static?
drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c:239:39: warning:
 symbol 'etnaviv_iommuv2_ops' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/gpu/drm/etnaviv/etnaviv_iommu.c | 2 +-
 drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c | 2 +-
 2 file changed, 2 insertion(+), 2 deletion(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c 
b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
index 7a8c947..4b9b11c 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
@@ -158,7 +158,7 @@ void etnaviv_iommuv1_restore(struct etnaviv_gpu *gpu)
gpu_write(gpu, VIVS_MC_MMU_RA_PAGE_TABLE, pgtable);
 }
 
-const struct etnaviv_iommu_domain_ops etnaviv_iommuv1_ops = {
+static const struct etnaviv_iommu_domain_ops etnaviv_iommuv1_ops = {
.free = etnaviv_iommuv1_domain_free,
.map = etnaviv_iommuv1_map,
.unmap = etnaviv_iommuv1_unmap,
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c 
b/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c
index 1e956e2..6e7c892 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c
@@ -236,7 +236,7 @@ void etnaviv_iommuv2_restore(struct etnaviv_gpu *gpu)
gpu_write(gpu, VIVS_MMUv2_CONTROL, VIVS_MMUv2_CONTROL_ENABLE);
 }
 
-const struct etnaviv_iommu_domain_ops etnaviv_iommuv2_ops = {
+static const struct etnaviv_iommu_domain_ops etnaviv_iommuv2_ops = {
.free = etnaviv_iommuv2_domain_free,
.map = etnaviv_iommuv2_map,
.unmap = etnaviv_iommuv2_unmap,



[PATCH -next] test_firmware: make local symbol test_fw_config static

2018-01-11 Thread Wei Yongjun
Fixes the following sparse warnings:

lib/test_firmware.c:99:20: warning:
 symbol 'test_fw_config' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 lib/test_firmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_firmware.c b/lib/test_firmware.c
index 964784d..1e907dd3b4 100644
--- a/lib/test_firmware.c
+++ b/lib/test_firmware.c
@@ -96,7 +96,7 @@ struct test_config {
struct device *device);
 };
 
-struct test_config *test_fw_config;
+static struct test_config *test_fw_config;
 
 static ssize_t test_fw_misc_read(struct file *f, char __user *buf,
 size_t size, loff_t *offset)



[PATCH -next] test_firmware: fix missing unlock on error in config_num_requests_store()

2018-01-11 Thread Wei Yongjun
Add the missing unlock before return from function
config_num_requests_store() in the error handling case.

Fixes: c92316bf8e94 ("test_firmware: add batched firmware tests")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 lib/test_firmware.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/test_firmware.c b/lib/test_firmware.c
index 964784d..4647647 100644
--- a/lib/test_firmware.c
+++ b/lib/test_firmware.c
@@ -371,6 +371,7 @@ static ssize_t config_num_requests_store(struct device *dev,
if (test_fw_config->reqs) {
pr_err("Must call release_all_firmware prior to changing 
config\n");
rc = -EINVAL;
+   mutex_unlock(_fw_mutex);
goto out;
}
mutex_unlock(_fw_mutex);



[PATCH -next] ASoC: stm32: fix a typo in stm32_adfsdm_probe()

2018-01-11 Thread Wei Yongjun
Fix a typo, we should return PTR_ERR(priv->iio_cb) instead of
PTR_ERR(priv->iio_ch).

Fixes: 55da094824c4 ("ASoC: stm32: add DFSDM DAI support")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 sound/soc/stm/stm32_adfsdm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c
index af50891..7306e3e 100644
--- a/sound/soc/stm/stm32_adfsdm.c
+++ b/sound/soc/stm/stm32_adfsdm.c
@@ -320,7 +320,7 @@ static int stm32_adfsdm_probe(struct platform_device *pdev)
 
priv->iio_cb = iio_channel_get_all_cb(>dev, NULL, NULL);
if (IS_ERR(priv->iio_cb))
-   return PTR_ERR(priv->iio_ch);
+   return PTR_ERR(priv->iio_cb);
 
ret = devm_snd_soc_register_platform(>dev,
 _adfsdm_soc_platform);



[PATCH -next] clocksource/drivers/stm32: fix error return code in stm32_timer_init()

2018-01-10 Thread Wei Yongjun
Fix to return error code -ENOMEM from the kzalloc error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/clocksource/timer-stm32.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-stm32.c 
b/drivers/clocksource/timer-stm32.c
index e5cdc3a..2717f88 100644
--- a/drivers/clocksource/timer-stm32.c
+++ b/drivers/clocksource/timer-stm32.c
@@ -304,8 +304,10 @@ static int __init stm32_timer_init(struct device_node 
*node)
 
to->private_data = kzalloc(sizeof(struct stm32_timer_private),
   GFP_KERNEL);
-   if (!to->private_data)
+   if (!to->private_data) {
+   ret = -ENOMEM;
goto deinit;
+   }
 
rstc = of_reset_control_get(node, NULL);
if (!IS_ERR(rstc)) {





[PATCH -next] meson-mx-socinfo: Make local function meson_mx_socinfo_init() static

2018-01-10 Thread Wei Yongjun
Fixes the following sparse warnings:

drivers/soc/amlogic/meson-mx-socinfo.c:107:12: warning:
 symbol 'meson_mx_socinfo_init' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/soc/amlogic/meson-mx-socinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/amlogic/meson-mx-socinfo.c 
b/drivers/soc/amlogic/meson-mx-socinfo.c
index 7bfff5f..78f0f1a 100644
--- a/drivers/soc/amlogic/meson-mx-socinfo.c
+++ b/drivers/soc/amlogic/meson-mx-socinfo.c
@@ -104,7 +104,7 @@ static const char *meson_mx_socinfo_soc_id(unsigned int 
major_ver,
{ /* sentinel */ }
 };
 
-int __init meson_mx_socinfo_init(void)
+static int __init meson_mx_socinfo_init(void)
 {
struct soc_device_attribute *soc_dev_attr;
struct soc_device *soc_dev;



[PATCH -next] meson-gx-socinfo: make local function meson_gx_socinfo_init static

2018-01-10 Thread Wei Yongjun
Fixes the following sparse warnings:

drivers/soc/amlogic/meson-gx-socinfo.c:100:12: warning:
 symbol 'meson_gx_socinfo_init' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/soc/amlogic/meson-gx-socinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c 
b/drivers/soc/amlogic/meson-gx-socinfo.c
index f2d8c3c..ea091f1 100644
--- a/drivers/soc/amlogic/meson-gx-socinfo.c
+++ b/drivers/soc/amlogic/meson-gx-socinfo.c
@@ -97,7 +97,7 @@ static const char *socinfo_to_soc_id(u32 socinfo)
return "Unknown";
 }
 
-int __init meson_gx_socinfo_init(void)
+static int __init meson_gx_socinfo_init(void)
 {
struct soc_device_attribute *soc_dev_attr;
struct soc_device *soc_dev;





[PATCH -next] ASoC: mediatek: mt2701: fix return value check in mt2701_afe_pcm_dev_probe()

2018-01-07 Thread Wei Yongjun
In case of error, the function syscon_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: dfa3cbb83e09 ("ASoC: mediatek: modify MT2701 AFE driver to adapt mfd 
device")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c 
b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
index f0cd08f..5bc4e00 100644
--- a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
+++ b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
@@ -1440,9 +1440,9 @@ static int mt2701_afe_pcm_dev_probe(struct 
platform_device *pdev)
}
 
afe->regmap = syscon_node_to_regmap(dev->parent->of_node);
-   if (!afe->regmap) {
+   if (IS_ERR(afe->regmap)) {
dev_err(dev, "could not get regmap from parent\n");
-   return -ENODEV;
+   return PTR_ERR(afe->regmap);
}
 
mutex_init(>irq_alloc_lock);



[PATCH -next] f2fs: make local functions static

2018-01-05 Thread Wei Yongjun
Fixes the following sparse warnings:

fs/f2fs/segment.c:887:6: warning:
 symbol '__check_sit_bitmap' was not declared. Should it be static?
fs/f2fs/segment.c:1327:6: warning:
 symbol 'f2fs_wait_discard_bio' was not declared. Should it be static?
fs/f2fs/super.c:1661:5: warning:
 symbol 'f2fs_get_projid' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 fs/f2fs/segment.c | 4 ++--
 fs/f2fs/super.c | 2 +-
 2 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index b03f65e..36bfd53 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -884,7 +884,7 @@ static void f2fs_submit_discard_endio(struct bio *bio)
bio_put(bio);
 }
 
-void __check_sit_bitmap(struct f2fs_sb_info *sbi,
+static void __check_sit_bitmap(struct f2fs_sb_info *sbi,
block_t start, block_t end)
 {
 #ifdef CONFIG_F2FS_CHECK_FS
@@ -1324,7 +1324,7 @@ static void __wait_all_discard_cmd(struct f2fs_sb_info 
*sbi,
 }
 
 /* This should be covered by global mutex, _i->sentry_lock */
-void f2fs_wait_discard_bio(struct f2fs_sb_info *sbi, block_t blkaddr)
+static void f2fs_wait_discard_bio(struct f2fs_sb_info *sbi, block_t blkaddr)
 {
struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
struct discard_cmd *dc;
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index f562307..9958fbf 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1658,7 +1658,7 @@ void f2fs_quota_off_umount(struct super_block *sb)
f2fs_quota_off(sb, type);
 }
 
-int f2fs_get_projid(struct inode *inode, kprojid_t *projid)
+static int f2fs_get_projid(struct inode *inode, kprojid_t *projid)
 {
*projid = F2FS_I(inode)->i_projid;
return 0;



[PATCH -next] um: vector: fix missing unlock on error in vector_net_open()

2018-01-04 Thread Wei Yongjun
Add the missing unlock before return from function vector_net_open()
in the error handling case.

Fixes: ad1f62ab2bd4 ("High Performance UML Vector Network Driver")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 arch/um/drivers/vector_kern.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
index d1d5301..bb83a2d 100644
--- a/arch/um/drivers/vector_kern.c
+++ b/arch/um/drivers/vector_kern.c
@@ -1156,8 +1156,10 @@ static int vector_net_open(struct net_device *dev)
struct vector_device *vdevice;
 
spin_lock_irqsave(>lock, flags);
-   if (vp->opened)
+   if (vp->opened) {
+   spin_unlock_irqrestore(>lock, flags);
return -ENXIO;
+   }
vp->opened = true;
spin_unlock_irqrestore(>lock, flags);



[PATCH -next] drm/panel: ili9322:Make local symbols static

2018-01-02 Thread Wei Yongjun
Fixes the following sparse warnings:

drivers/gpu/drm/panel/panel-ilitek-ili9322.c:182:12: warning:
 symbol 'ili9322_inputs' was not declared. Should it be static?
drivers/gpu/drm/panel/panel-ilitek-ili9322.c:343:28: warning:
 symbol 'ili9322_regmap_config' was not declared. Should it be static?

Also change ili9322_inputs to 'const char * const' to avoid
chackpatch warning.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
index b4ec0ec..bd38bf4 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
@@ -179,7 +179,7 @@ enum ili9322_input {
ILI9322_INPUT_UNKNOWN = 0xc,
 };
 
-const char *ili9322_inputs[] = {
+static const char * const ili9322_inputs[] = {
"8 bit serial RGB through",
"8 bit serial RGB aligned",
"8 bit serial RGB dummy 320x240",
@@ -340,7 +340,7 @@ static bool ili9322_writeable_reg(struct device *dev, 
unsigned int reg)
return true;
 }
 
-const struct regmap_config ili9322_regmap_config = {
+static const struct regmap_config ili9322_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = 0x44,



[PATCH -next] irqchip/ompic: fix return value check in ompic_of_init()

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

Fixes: 9b54470afd83 ("irqchip: add initial support for ompic")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/irqchip/irq-ompic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-ompic.c b/drivers/irqchip/irq-ompic.c
index cf6d0c4..400b119 100644
--- a/drivers/irqchip/irq-ompic.c
+++ b/drivers/irqchip/irq-ompic.c
@@ -171,9 +171,9 @@ static int __init ompic_of_init(struct device_node *node,
 
/* Setup the device */
ompic_base = ioremap(res.start, resource_size());
-   if (IS_ERR(ompic_base)) {
+   if (!ompic_base) {
pr_err("ompic: unable to map registers");
-   return PTR_ERR(ompic_base);
+   return -ENOMEM;
}
 
irq = irq_of_parse_and_map(node, 0);



[PATCH -next] dm raid: make local symbol raid_sets static

2018-01-01 Thread Wei Yongjun
Fixes the following sparse warning:

drivers/md/dm-raid.c:33:1: warning:
 symbol 'raid_sets' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/md/dm-raid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index a96ca44..7ef469e 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -30,7 +30,7 @@
 #defineMIN_RAID456_JOURNAL_SPACE (4*2048)
 
 /* Global list of all raid sets */
-LIST_HEAD(raid_sets);
+static LIST_HEAD(raid_sets);
 
 static bool devices_handle_discard_safely = false;



[PATCH -next] tee: shm: make local function __tee_shm_alloc() static

2018-01-01 Thread Wei Yongjun
Fixes the following sparse warnings:

drivers/tee/tee_shm.c:115:16: warning:
 symbol '__tee_shm_alloc' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/tee/tee_shm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
index 04e1b8b..13b4de1 100644
--- a/drivers/tee/tee_shm.c
+++ b/drivers/tee/tee_shm.c
@@ -112,9 +112,9 @@ static int tee_shm_op_mmap(struct dma_buf *dmabuf, struct 
vm_area_struct *vma)
.mmap = tee_shm_op_mmap,
 };
 
-struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
-   struct tee_device *teedev,
-   size_t size, u32 flags)
+static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
+  struct tee_device *teedev,
+  size_t size, u32 flags)
 {
struct tee_shm_pool_mgr *poolm = NULL;
struct tee_shm *shm;



[PATCH -next] soundwire: Fix typo in return value check of sdw_read()

2018-01-01 Thread Wei Yongjun
Fix the typo, 'status' should be instead of 'status2'.

Fixes: b0a9c37b0178 ("soundwire: Add slave status handling")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/soundwire/bus.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index 4c34519..266d2b3 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -671,8 +671,8 @@ static int sdw_handle_dp0_interrupt(struct sdw_slave 
*slave, u8 *slave_status)
status2 = sdw_read(slave, SDW_DP0_INT);
if (status2 < 0) {
dev_err(slave->bus->dev,
-   "SDW_DP0_INT read failed:%d", status);
-   return status;
+   "SDW_DP0_INT read failed:%d", status2);
+   return status2;
}
status &= status2;
 
@@ -741,10 +741,10 @@ static int sdw_handle_port_interrupt(struct sdw_slave 
*slave,
 
/* Read DPN interrupt again */
status2 = sdw_read(slave, addr);
-   if (status < 0) {
+   if (status2 < 0) {
dev_err(slave->bus->dev,
-   "SDW_DPN_INT read failed:%d", status);
-   return status;
+   "SDW_DPN_INT read failed:%d", status2);
+   return status2;
}
status &= status2;



[PATCH -next] slimbus: qcom: Make some local functions static

2018-01-01 Thread Wei Yongjun
Fixes the following sparse warnings:

drivers/slimbus/qcom-ctrl.c:151:6: warning:
 symbol 'slim_ack_txn' was not declared. Should it be static?
drivers/slimbus/qcom-ctrl.c:304:6: warning:
 symbol 'slim_alloc_txbuf' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/slimbus/qcom-ctrl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c
index 35ad70d..600f62d 100644
--- a/drivers/slimbus/qcom-ctrl.c
+++ b/drivers/slimbus/qcom-ctrl.c
@@ -148,7 +148,7 @@ static void *slim_alloc_rxbuf(struct qcom_slim_ctrl *ctrl)
return ctrl->rx.base + (idx * ctrl->rx.sl_sz);
 }
 
-void slim_ack_txn(struct qcom_slim_ctrl *ctrl, int err)
+static void slim_ack_txn(struct qcom_slim_ctrl *ctrl, int err)
 {
struct completion *comp;
unsigned long flags;
@@ -301,8 +301,8 @@ static int qcom_clk_pause_wakeup(struct slim_controller 
*sctrl)
return 0;
 }
 
-void *slim_alloc_txbuf(struct qcom_slim_ctrl *ctrl, struct slim_msg_txn *txn,
-  struct completion *done)
+static void *slim_alloc_txbuf(struct qcom_slim_ctrl *ctrl,
+ struct slim_msg_txn *txn, struct completion *done)
 {
unsigned long flags;
int idx;



[PATCH -next] slimbus: Use GFP_ATOMIC under spin lock

2018-01-01 Thread Wei Yongjun
A spin lock is taken here so we should use GFP_ATOMIC.

Fixes: afbdcc7c384b ("slimbus: Add messaging APIs to slimbus framework")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/slimbus/messaging.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/slimbus/messaging.c b/drivers/slimbus/messaging.c
index 755462a..ef54ea1 100644
--- a/drivers/slimbus/messaging.c
+++ b/drivers/slimbus/messaging.c
@@ -98,7 +98,7 @@ int slim_do_transfer(struct slim_controller *ctrl, struct 
slim_msg_txn *txn)
if (need_tid) {
spin_lock_irqsave(>txn_lock, flags);
tid = idr_alloc(>tid_idr, txn, 0,
-   SLIM_MAX_TIDS, GFP_KERNEL);
+   SLIM_MAX_TIDS, GFP_ATOMIC);
txn->tid = tid;
 
if (!txn->msg->comp)



[PATCH -next] slimbus: qcom: Fix return value check in qcom_slim_probe()

2018-01-01 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: ad7fcbc308b0 ("slimbus: qcom: Add Qualcomm Slimbus controller driver")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/slimbus/qcom-ctrl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c
index 35ad70d..96fefd6 100644
--- a/drivers/slimbus/qcom-ctrl.c
+++ b/drivers/slimbus/qcom-ctrl.c
@@ -530,9 +530,9 @@ static int qcom_slim_probe(struct platform_device *pdev)
 
slim_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl");
ctrl->base = devm_ioremap_resource(ctrl->dev, slim_mem);
-   if (!ctrl->base) {
+   if (IS_ERR(ctrl->base)) {
dev_err(>dev, "IOremap failed\n");
-   return -ENOMEM;
+   return PTR_ERR(ctrl->base);
}
 
sctrl->set_laddr = qcom_set_laddr;



[PATCH -next] slimbus: Fix missing unlock on error in slim_msg_response()

2018-01-01 Thread Wei Yongjun
Add the missing unlock before return from function slim_msg_response()
in the error handling case.

Fixes: afbdcc7c384b ("slimbus: Add messaging APIs to slimbus framework")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/slimbus/messaging.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/slimbus/messaging.c b/drivers/slimbus/messaging.c
index 755462a..a1328ac 100644
--- a/drivers/slimbus/messaging.c
+++ b/drivers/slimbus/messaging.c
@@ -38,6 +38,7 @@ void slim_msg_response(struct slim_controller *ctrl, u8 
*reply, u8 tid, u8 len)
if (msg == NULL || msg->rbuf == NULL) {
dev_err(ctrl->dev, "Got response to invalid TID:%d, len:%d\n",
tid, len);
+   spin_unlock_irqrestore(>txn_lock, flags);
return;
}



[PATCH -next] xen/pvcalls: use GFP_ATOMIC under spin lock

2017-12-27 Thread Wei Yongjun
A spin lock is taken here so we should use GFP_ATOMIC.

Fixes: 9774c6cca266 ("xen/pvcalls: implement accept command")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/xen/pvcalls-front.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c
index 0c1ec68..dfd00d9 100644
--- a/drivers/xen/pvcalls-front.c
+++ b/drivers/xen/pvcalls-front.c
@@ -807,7 +807,7 @@ int pvcalls_front_accept(struct socket *sock, struct socket 
*newsock, int flags)
pvcalls_exit();
return ret;
}
-   map2 = kzalloc(sizeof(*map2), GFP_KERNEL);
+   map2 = kzalloc(sizeof(*map2), GFP_ATOMIC);
if (map2 == NULL) {
clear_bit(PVCALLS_FLAG_ACCEPT_INFLIGHT,
  (void *)>passive.flags);



[PATCH -next] mtd: sharpslpart: make local function sharpsl_nand_cleanup_ftl() static

2017-12-19 Thread Wei Yongjun
Fixes the following sparse warnings:

drivers/mtd/parsers/sharpslpart.c:222:6: warning:
 symbol 'sharpsl_nand_cleanup_ftl' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/mtd/parsers/sharpslpart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/parsers/sharpslpart.c 
b/drivers/mtd/parsers/sharpslpart.c
index 0ddb79a..8893dc8 100644
--- a/drivers/mtd/parsers/sharpslpart.c
+++ b/drivers/mtd/parsers/sharpslpart.c
@@ -219,7 +219,7 @@ static int sharpsl_nand_init_ftl(struct mtd_info *mtd, 
struct sharpsl_ftl *ftl)
return ret;
 }
 
-void sharpsl_nand_cleanup_ftl(struct sharpsl_ftl *ftl)
+static void sharpsl_nand_cleanup_ftl(struct sharpsl_ftl *ftl)
 {
kfree(ftl->log2phy);
 }



[tip:irq/urgent] irqchip/exiu: Fix return value check in exiu_init()

2017-11-14 Thread tip-bot for Wei Yongjun
Commit-ID:  0e54705b0e01dcaf3eb2a496bb66d5f05012056b
Gitweb: https://git.kernel.org/tip/0e54705b0e01dcaf3eb2a496bb66d5f05012056b
Author: Wei Yongjun <weiyongj...@huawei.com>
AuthorDate: Tue, 14 Nov 2017 06:57:28 +
Committer:  Thomas Gleixner <t...@linutronix.de>
CommitDate: Tue, 14 Nov 2017 11:27:22 +0100

irqchip/exiu: Fix return value check in exiu_init()

In case of error, the function of_iomap() returns NULL pointer not
ERR_PTR().

Replace the IS_ERR() test of the return value with NULL test and return
a proper error code.

Fixes: 706cffc1b912 ("irqchip/exiu: Add support for Socionext Synquacer EXIU 
controller")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
Signed-off-by: Thomas Gleixner <t...@linutronix.de>
Acked-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
Cc: Marc Zyngier <marc.zyng...@arm.com>
Cc: Jason Cooper <ja...@lakedaemon.net>
Link: 
https://lkml.kernel.org/r/1510642648-123574-1-git-send-email-weiyongj...@huawei.com

---
 drivers/irqchip/irq-sni-exiu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-sni-exiu.c b/drivers/irqchip/irq-sni-exiu.c
index 1b6e2f7..1927b2f 100644
--- a/drivers/irqchip/irq-sni-exiu.c
+++ b/drivers/irqchip/irq-sni-exiu.c
@@ -196,8 +196,8 @@ static int __init exiu_init(struct device_node *node,
}
 
data->base = of_iomap(node, 0);
-   if (IS_ERR(data->base)) {
-   err = PTR_ERR(data->base);
+   if (!data->base) {
+   err = -ENODEV;
goto out_free;
}
 


[PATCH -next] irqchip/exiu: Fix return value check in exiu_init()

2017-11-13 Thread Wei Yongjun
In case of error, the function of_iomap() returns NULL pointer not
ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: 706cffc1b912 ("irqchip/exiu: Add support for Socionext Synquacer EXIU 
controller")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/irqchip/irq-sni-exiu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-sni-exiu.c b/drivers/irqchip/irq-sni-exiu.c
index 1b6e2f7..1927b2f 100644
--- a/drivers/irqchip/irq-sni-exiu.c
+++ b/drivers/irqchip/irq-sni-exiu.c
@@ -196,8 +196,8 @@ static int __init exiu_init(struct device_node *node,
}
 
data->base = of_iomap(node, 0);
-   if (IS_ERR(data->base)) {
-   err = PTR_ERR(data->base);
+   if (!data->base) {
+   err = -ENODEV;
goto out_free;
}



[PATCH -next] ipmi_si_platform: Fix typo in parameter description

2017-11-03 Thread Wei Yongjun
Fix typo in parameter description.

Fixes: 95e300c052fd ("ipmi: Make the DMI probe into a generic platform probe")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/char/ipmi/ipmi_si_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/ipmi/ipmi_si_platform.c 
b/drivers/char/ipmi/ipmi_si_platform.c
index 9573f11..f421487 100644
--- a/drivers/char/ipmi/ipmi_si_platform.c
+++ b/drivers/char/ipmi/ipmi_si_platform.c
@@ -40,7 +40,7 @@
 #endif
 #ifdef CONFIG_OF
 module_param_named(tryopenfirmware, si_tryopenfirmware, bool, 0);
-MODULE_PARM_DESC(tryacpi, "Setting this to zero will disable the"
+MODULE_PARM_DESC(tryopenfirmware, "Setting this to zero will disable the"
 " default scan of the interfaces identified via OpenFirmware");
 #endif
 #ifdef CONFIG_DMI



[PATCH -next] ipmi watchdog: fix typo in parameter description

2017-11-03 Thread Wei Yongjun
Fix typo in parameter description.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/char/ipmi/ipmi_watchdog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/ipmi/ipmi_watchdog.c 
b/drivers/char/ipmi/ipmi_watchdog.c
index 76b2706..09e8463 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -298,7 +298,7 @@ static int set_param_wdog_ifnum(const char *val, const 
struct kernel_param *kp)
 MODULE_PARM_DESC(pretimeout, "Pretimeout value in seconds.");
 
 module_param(panic_wdt_timeout, timeout, 0644);
-MODULE_PARM_DESC(timeout, "Timeout value on kernel panic in seconds.");
+MODULE_PARM_DESC(panic_wdt_timeout, "Timeout value on kernel panic in 
seconds.");
 
 module_param_cb(action, _ops_str, action_op, 0644);
 MODULE_PARM_DESC(action, "Timeout action. One of: "



[PATCH -next] nullb: fix error return code in null_init()

2017-10-17 Thread Wei Yongjun
Fix to return error code -ENOMEM from the null_alloc_dev() error
handling case instead of 0, as done elsewhere in this function.

Fixes: 2984c8684f96 ("nullb: factor disk parameters")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/block/null_blk.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index bf2c8ca..50c83c4 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -1991,8 +1991,10 @@ static int __init null_init(void)
 
for (i = 0; i < nr_devices; i++) {
dev = null_alloc_dev();
-   if (!dev)
+   if (!dev) {
+   ret = -ENOMEM;
goto err_dev;
+   }
ret = null_add_dev(dev);
if (ret) {
null_free_dev(dev);



[PATCH -next] iommu/ipmmu-vmsa: Fix return value check in ipmmu_find_group_dma()

2017-10-17 Thread Wei Yongjun
In case of error, the function iommu_group_get() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: 3ae47292024f ("iommu/ipmmu-vmsa: Add new IOMMU_DOMAIN_DMA ops")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/iommu/ipmmu-vmsa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index af81400..00e88a8 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -871,7 +871,7 @@ static struct iommu_group *ipmmu_find_group_dma(struct 
device *dev)
sibling = ipmmu_find_sibling_device(dev);
if (sibling)
group = iommu_group_get(sibling);
-   if (!sibling || IS_ERR(group))
+   if (!sibling || !group)
group = generic_device_group(dev);
 
return group;



[PATCH -next] MIPS: bpf: Fix a typo in build_one_insn()

2017-10-13 Thread Wei Yongjun
Fix a typo in build_one_insn().

Fixes: b6bd53f9c4e8 ("MIPS: Add missing file for eBPF JIT.")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 arch/mips/net/ebpf_jit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/net/ebpf_jit.c b/arch/mips/net/ebpf_jit.c
index 01b7a87..962b025 100644
--- a/arch/mips/net/ebpf_jit.c
+++ b/arch/mips/net/ebpf_jit.c
@@ -1513,7 +1513,7 @@ static int build_one_insn(const struct bpf_insn *insn, 
struct jit_ctx *ctx,
}
src = ebpf_to_mips_reg(ctx, insn, src_reg_no_fp);
if (src < 0)
-   return dst;
+   return src;
if (BPF_MODE(insn->code) == BPF_XADD) {
switch (BPF_SIZE(insn->code)) {
case BPF_W:



[PATCH] drm: Fix return value check in kirin_drm_platform_probe()

2017-10-11 Thread Wei Yongjun
In case of error, the function of_graph_get_remote_node() 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 <weiyongj...@huawei.com>
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index e27352c..527aa58 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -236,8 +236,8 @@ static int kirin_drm_platform_probe(struct platform_device 
*pdev)
}
 
remote = of_graph_get_remote_node(np, 0, 0);
-   if (IS_ERR(remote))
-   return PTR_ERR(remote);
+   if (!remote)
+   return -ENODEV;
 
drm_of_component_match_add(dev, , compare_of, remote);
of_node_put(remote);





[tip:ras/core] RAS: Make local function parse_ras_param() static

2017-05-21 Thread tip-bot for Wei Yongjun
Commit-ID:  5f0744e50db1628d6de770b92278445b3de2779f
Gitweb: http://git.kernel.org/tip/5f0744e50db1628d6de770b92278445b3de2779f
Author: Wei Yongjun <weiyongj...@huawei.com>
AuthorDate: Fri, 19 May 2017 11:39:12 +0200
Committer:  Thomas Gleixner <t...@linutronix.de>
CommitDate: Sun, 21 May 2017 21:55:12 +0200

RAS: Make local function parse_ras_param() static

Make parse_ras_param() static as it is used locally only.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
Signed-off-by: Borislav Petkov <b...@suse.de>
Link: http://lkml.kernel.org/r/20170516161034.2973-1-weiyj...@gmail.com
Signed-off-by: Thomas Gleixner <t...@linutronix.de>

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

diff --git a/drivers/ras/ras.c b/drivers/ras/ras.c
index 94f8038..ed4c343 100644
--- a/drivers/ras/ras.c
+++ b/drivers/ras/ras.c
@@ -29,7 +29,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(extlog_mem_event);
 EXPORT_TRACEPOINT_SYMBOL_GPL(mc_event);
 
 
-int __init parse_ras_param(char *str)
+static int __init parse_ras_param(char *str)
 {
 #ifdef CONFIG_RAS_CEC
parse_cec_param(str);


[PATCH -next] drm/vgem: Fix return value check in vgem_init()

2017-05-20 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

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

Fixes: 315f0242aa2b ("drm/vgem: Convert to a struct drm_device subclass")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/gpu/drm/vgem/vgem_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index 54ec94c..18f401b 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -438,8 +438,8 @@ static int __init vgem_init(void)
 
vgem_device->platform =
platform_device_register_simple("vgem", -1, NULL, 0);
-   if (!vgem_device->platform) {
-   ret = -ENODEV;
+   if (IS_ERR(vgem_device->platform)) {
+   ret = PTR_ERR(vgem_device->platform);
goto out_fini;
}



[PATCH -next] drm/pl111: Fix return value check in pl111_amba_probe()

2017-05-20 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

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: bed41005e617 ("drm/pl111: Initial drm/kms driver for pl111")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/gpu/drm/pl111/pl111_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/pl111/pl111_drv.c 
b/drivers/gpu/drm/pl111/pl111_drv.c
index 936403f..c6b93ff 100644
--- a/drivers/gpu/drm/pl111/pl111_drv.c
+++ b/drivers/gpu/drm/pl111/pl111_drv.c
@@ -203,9 +203,9 @@ static int pl111_amba_probe(struct amba_device *amba_dev,
}
 
priv->regs = devm_ioremap_resource(dev, _dev->res);
-   if (!priv->regs) {
+   if (IS_ERR(priv->regs)) {
dev_err(dev, "%s failed mmio\n", __func__);
-   return -EINVAL;
+   return PTR_ERR(priv->regs);
}
 
/* turn off interrupts before requesting the irq */



[PATCH] goldfish_pipe: use GFP_ATOMIC under spin lock

2017-05-20 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

The function get_free_pipe_id_locked() is called from
goldfish_pipe_open() with a lock is held, so we should
use GFP_ATOMIC instead of GFP_KERNEL.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/platform/goldfish/goldfish_pipe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c 
b/drivers/platform/goldfish/goldfish_pipe.c
index 2de1e60..5f36721 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -704,7 +704,7 @@ static int get_free_pipe_id_locked(struct goldfish_pipe_dev 
*dev)
/* Reallocate the array */
u32 new_capacity = 2 * dev->pipes_capacity;
struct goldfish_pipe **pipes =
-   kcalloc(new_capacity, sizeof(*pipes), GFP_KERNEL);
+   kcalloc(new_capacity, sizeof(*pipes), GFP_ATOMIC);
if (!pipes)
return -ENOMEM;
memcpy(pipes, dev->pipes, sizeof(*pipes) * dev->pipes_capacity);



[PATCH -next] drm/i915: Fix return value check in kfence selftests

2017-05-18 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fix the return value check which testing the wrong variable.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/gpu/drm/i915/selftests/i915_sw_fence.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c 
b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
index 98baf10..c31d439 100644
--- a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
+++ b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
@@ -311,7 +311,7 @@ static int test_AB_C(void *arg)
}
 
C = alloc_fence();
-   if (!B) {
+   if (!C) {
ret = -ENOMEM;
goto err_B;
}
@@ -388,7 +388,7 @@ static int test_C_AB(void *arg)
}
 
C = alloc_fence();
-   if (!B) {
+   if (!C) {
ret = -ENOMEM;
goto err_B;
}



[PATCH -next] ASoC: rt5665: make local symbol rt5665_i2c_driver static

2017-05-16 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fixes the following sparse warnings:

sound/soc/codecs/rt5665.c:4928:19: warning:
symbol 'rt5665_i2c_driver' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 sound/soc/codecs/rt5665.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt5665.c b/sound/soc/codecs/rt5665.c
index 26bf157..bb440bd 100644
--- a/sound/soc/codecs/rt5665.c
+++ b/sound/soc/codecs/rt5665.c
@@ -4925,7 +4925,7 @@ static struct acpi_device_id rt5665_acpi_match[] = {
 MODULE_DEVICE_TABLE(acpi, rt5665_acpi_match);
 #endif
 
-struct i2c_driver rt5665_i2c_driver = {
+static struct i2c_driver rt5665_i2c_driver = {
.driver = {
.name = "rt5665",
.of_match_table = of_match_ptr(rt5665_of_match),



[PATCH -next] RAS: Make local function parse_ras_param() static

2017-05-16 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fixes the following sparse warning:

drivers/ras/ras.c:32:12: warning:
 symbol 'parse_ras_param' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/ras/ras.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ras/ras.c b/drivers/ras/ras.c
index 94f8038..ed4c343 100644
--- a/drivers/ras/ras.c
+++ b/drivers/ras/ras.c
@@ -29,7 +29,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(extlog_mem_event);
 EXPORT_TRACEPOINT_SYMBOL_GPL(mc_event);
 
 
-int __init parse_ras_param(char *str)
+static int __init parse_ras_param(char *str)
 {
 #ifdef CONFIG_RAS_CEC
parse_cec_param(str);



[tip:irq/core] irqchip/mbigen: Fix return value check in mbigen_device_probe()

2017-04-30 Thread tip-bot for Wei Yongjun
Commit-ID:  216646e4d82e847791f0ba66c439dedd36cb119f
Gitweb: http://git.kernel.org/tip/216646e4d82e847791f0ba66c439dedd36cb119f
Author: Wei Yongjun <weiyongj...@huawei.com>
AuthorDate: Thu, 27 Apr 2017 15:21:13 +
Committer:  Thomas Gleixner <t...@linutronix.de>
CommitDate: Sun, 30 Apr 2017 11:21:16 +0200

irqchip/mbigen: Fix return value check in mbigen_device_probe()

In case of error, the function devm_ioremap() returns NULL pointer
not ERR_PTR(). Use devm_ioremap_resource() instead of devm_ioremap()
to fix the IS_ERR() test issue.

Fixes: 76e1f77f9c26 ("irqchip/mbigen: Introduce mbigen_of_create_domain()")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
Cc: Marc Zyngier <marc.zyng...@arm.com>
Cc: Kefeng Wang <wangkefeng.w...@huawei.com>
Cc: Jason Cooper <ja...@lakedaemon.net>
Link: http://lkml.kernel.org/r/20170427152113.31147-1-weiyj...@gmail.com
Signed-off-by: Thomas Gleixner <t...@linutronix.de>

---
 drivers/irqchip/irq-mbigen.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
index 061cdb8..d2306c8 100644
--- a/drivers/irqchip/irq-mbigen.c
+++ b/drivers/irqchip/irq-mbigen.c
@@ -337,8 +337,7 @@ static int mbigen_device_probe(struct platform_device *pdev)
mgn_chip->pdev = pdev;
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   mgn_chip->base = devm_ioremap(>dev, res->start,
- resource_size(res));
+   mgn_chip->base = devm_ioremap_resource(>dev, res);
if (IS_ERR(mgn_chip->base))
return PTR_ERR(mgn_chip->base);
 


[PATCH -next] irqchip/mbigen: Fix return value check in mbigen_device_probe()

2017-04-27 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

In case of error, the function devm_ioremap() returns NULL pointer
not ERR_PTR(). Use devm_ioremap_resource() instead of devm_ioremap()
to fix the IS_ERR() test issue.

Fixes: 76e1f77f9c26 ("irqchip/mbigen: Introduce mbigen_of_create_domain()")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/irqchip/irq-mbigen.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
index 061cdb8..d2306c8 100644
--- a/drivers/irqchip/irq-mbigen.c
+++ b/drivers/irqchip/irq-mbigen.c
@@ -337,8 +337,7 @@ static int mbigen_device_probe(struct platform_device *pdev)
mgn_chip->pdev = pdev;
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   mgn_chip->base = devm_ioremap(>dev, res->start,
- resource_size(res));
+   mgn_chip->base = devm_ioremap_resource(>dev, res);
if (IS_ERR(mgn_chip->base))
return PTR_ERR(mgn_chip->base);



[PATCH -next] firmware: Google VPD: Fix return value check in vpd_platform_init()

2017-04-26 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

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

Fixes: 049a59db34eb ("firmware: Google VPD sysfs driver")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/firmware/google/vpd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/google/vpd.c b/drivers/firmware/google/vpd.c
index 619f4ba..3ce8131 100644
--- a/drivers/firmware/google/vpd.c
+++ b/drivers/firmware/google/vpd.c
@@ -303,8 +303,8 @@ static int __init vpd_platform_init(void)
struct platform_device *pdev;
 
pdev = platform_device_register_simple("vpd", -1, NULL, 0);
-   if (!pdev)
-   return -ENODEV;
+   if (IS_ERR(pdev))
+   return PTR_ERR(pdev);
 
vpd_kobj = kobject_create_and_add("vpd", firmware_kobj);
if (!vpd_kobj)



[PATCH -next] auxdisplay: Convert list_for_each to entry variant

2017-04-25 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

convert list_for_each() to list_for_each_entry() where
applicable.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/auxdisplay/panel.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c
index e0c014c..7a8b8fb 100644
--- a/drivers/auxdisplay/panel.c
+++ b/drivers/auxdisplay/panel.c
@@ -1345,14 +1345,11 @@ static inline void input_state_falling(struct 
logical_input *input)
 
 static void panel_process_inputs(void)
 {
-   struct list_head *item;
struct logical_input *input;
 
keypressed = 0;
inputs_stable = 1;
-   list_for_each(item, _inputs) {
-   input = list_entry(item, struct logical_input, list);
-
+   list_for_each_entry(input, _inputs, list) {
switch (input->state) {
case INPUT_ST_LOW:
if ((phys_curr & input->mask) != input->value)



[PATCH -next] irqchip/qcom: Use builtin_platform_driver to simplify the code

2017-04-25 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Use the builtin_platform_driver() macro to make the code simpler.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/irqchip/qcom-irq-combiner.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/irqchip/qcom-irq-combiner.c 
b/drivers/irqchip/qcom-irq-combiner.c
index 2265586..6aa3ea4 100644
--- a/drivers/irqchip/qcom-irq-combiner.c
+++ b/drivers/irqchip/qcom-irq-combiner.c
@@ -288,9 +288,4 @@ static struct platform_driver qcom_irq_combiner_probe = {
},
.probe = combiner_probe,
 };
-
-static int __init register_qcom_irq_combiner(void)
-{
-   return platform_driver_register(_irq_combiner_probe);
-}
-device_initcall(register_qcom_irq_combiner);
+builtin_platform_driver(qcom_irq_combiner_probe);





[PATCH -next] drm/nouveau/secboot/gm20b: fix the error return code in gm20b_secboot_tegra_read_wpr()

2017-04-25 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

The error return code PTR_ERR(mc) is always 0 since mc is
equal to 0 in this error handling case.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
index b10ed59..30491d1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
@@ -48,7 +48,7 @@ gm20b_secboot_tegra_read_wpr(struct gm200_secboot *gsb, u32 
mc_base)
mc = ioremap(mc_base, 0xd00);
if (!mc) {
nvkm_error(>subdev, "Cannot map Tegra MC registers\n");
-   return PTR_ERR(mc);
+   return -ENOMEM;
}
sb->wpr_addr = ioread32_native(mc + MC_SECURITY_CARVEOUT2_BOM_0) |
  ((u64)ioread32_native(mc + MC_SECURITY_CARVEOUT2_BOM_HI_0) << 32);





[PATCH -next] phy: qcom-qmp: fix invalid use of sizeof in qcom_qmp_phy_vreg_init()

2017-04-25 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/phy/phy-qcom-qmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/phy-qcom-qmp.c b/drivers/phy/phy-qcom-qmp.c
index 727e23b..7d6085f 100644
--- a/drivers/phy/phy-qcom-qmp.c
+++ b/drivers/phy/phy-qcom-qmp.c
@@ -844,7 +844,7 @@ static int qcom_qmp_phy_vreg_init(struct device *dev)
int num = qmp->cfg->num_vregs;
int i;
 
-   qmp->vregs = devm_kcalloc(dev, num, sizeof(qmp->vregs), GFP_KERNEL);
+   qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL);
if (!qmp->vregs)
return -ENOMEM;



[PATCH -next] ASoC: Intel: Skylake: Fix to use list_for_each_safe() when delete items

2017-04-24 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Since we will remove items off the list using list_del() we need
to use a safe version of the list_for_each() macro aptly named
list_for_each_safe().

This is detected by Coccinelle semantic patch.

Fixes: b8c722ddd548 ("ASoC: Intel: Skylake: Add support for deferred
DSP module bind")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 sound/soc/intel/skylake/skl-pcm.c | 4 ++--
 sound/soc/intel/skylake/skl-topology.c | 4 ++--
 2 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c 
b/sound/soc/intel/skylake/skl-pcm.c
index 600faad..d43d197 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -1323,10 +1323,10 @@ int skl_platform_unregister(struct device *dev)
 {
struct hdac_ext_bus *ebus = dev_get_drvdata(dev);
struct skl *skl = ebus_to_skl(ebus);
-   struct skl_module_deferred_bind *modules;
+   struct skl_module_deferred_bind *modules, *tmp;
 
if (!list_empty(>bind_list)) {
-   list_for_each_entry(modules, >bind_list, node) {
+   list_for_each_entry_safe(modules, tmp, >bind_list, node) {
list_del(>node);
kfree(modules);
}
diff --git a/sound/soc/intel/skylake/skl-topology.c 
b/sound/soc/intel/skylake/skl-topology.c
index 74b3acf..aea7917 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -1091,7 +1091,7 @@ static int skl_tplg_mixer_dapm_post_pmd_event(struct 
snd_soc_dapm_widget *w,
struct skl_module_cfg *src_module = NULL, *dst_module;
struct skl_sst *ctx = skl->skl_sst;
struct skl_pipe *s_pipe = mconfig->pipe;
-   struct skl_module_deferred_bind *modules;
+   struct skl_module_deferred_bind *modules, *tmp;
 
if (s_pipe->state == SKL_PIPE_INVALID)
return -EINVAL;
@@ -1105,7 +1105,7 @@ static int skl_tplg_mixer_dapm_post_pmd_event(struct 
snd_soc_dapm_widget *w,
 
src_module = w_module->w->priv;
 
-   list_for_each_entry(modules, >bind_list, node) {
+   list_for_each_entry_safe(modules, tmp, >bind_list, node) {
/*
 * When the destination module is deleted, Unbind the
 * modules from deferred bind list.



[PATCH -next] drm/rockchip: cdn-dp: fix return value check in cdn_dp_probe()

2017-04-24 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fix the retrn value check which testing the wrong variable
in cdn_dp_probe().

Fixes: 1a0f7ed3abe2 ("drm/rockchip: cdn-dp: add cdn DP support for rk3399")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 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 9ab67a6..6a4a113 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -1198,7 +1198,7 @@ static int cdn_dp_probe(struct platform_device *pdev)
continue;
 
port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
-   if (!dp)
+   if (!port)
return -ENOMEM;
 
port->extcon = extcon;



[PATCH -next] phy: qcom-qmp: fix return value check in qcom_qmp_phy_create()

2017-04-24 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

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

Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/phy/phy-qcom-qmp.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/phy/phy-qcom-qmp.c b/drivers/phy/phy-qcom-qmp.c
index 727e23b..a25c29d 100644
--- a/drivers/phy/phy-qcom-qmp.c
+++ b/drivers/phy/phy-qcom-qmp.c
@@ -983,16 +983,16 @@ int qcom_qmp_phy_create(struct device *dev, struct 
device_node *np, int id)
 * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
 */
qphy->tx = of_iomap(np, 0);
-   if (IS_ERR(qphy->tx))
-   return PTR_ERR(qphy->tx);
+   if (!qphy->tx)
+   return -ENOMEM;
 
qphy->rx = of_iomap(np, 1);
-   if (IS_ERR(qphy->rx))
-   return PTR_ERR(qphy->rx);
+   if (!qphy->rx)
+   return -ENOMEM;
 
qphy->pcs = of_iomap(np, 2);
-   if (IS_ERR(qphy->pcs))
-   return PTR_ERR(qphy->pcs);
+   if (!qphy->pcs)
+   return -ENOMEM;
 
/*
 * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3



[PATCH -next] firmware: google memconsole: Fix return value check in platform_memconsole_init()

2017-04-24 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

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

Fixes: d384d6f43d1e ("firmware: google memconsole: Add coreboot support")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/firmware/google/memconsole-coreboot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/google/memconsole-coreboot.c 
b/drivers/firmware/google/memconsole-coreboot.c
index 2121014..027 100644
--- a/drivers/firmware/google/memconsole-coreboot.c
+++ b/drivers/firmware/google/memconsole-coreboot.c
@@ -95,8 +95,8 @@ static int __init platform_memconsole_init(void)
struct platform_device *pdev;
 
pdev = platform_device_register_simple("memconsole", -1, NULL, 0);
-   if (pdev == NULL)
-   return -ENODEV;
+   if (IS_ERR(pdev))
+   return PTR_ERR(pdev);
 
platform_driver_register(_driver);



  1   2   3   4   5   6   7   >