[PATCH] PCI: hv: Fix return value check in hv_pci_assign_slots()

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

Fixes: a15f2c08c708 ("PCI: hv: support reporting serial number as slot 
information")
Signed-off-by: Wei Yongjun 
---
 drivers/pci/controller/pci-hyperv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/pci-hyperv.c 
b/drivers/pci/controller/pci-hyperv.c
index ee80e79..9ba4d12 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -1484,8 +1484,10 @@ static void hv_pci_assign_slots(struct hv_pcibus_device 
*hbus)
snprintf(name, SLOT_NAME_SIZE, "%u", hpdev->desc.ser);
hpdev->pci_slot = pci_create_slot(hbus->pci_bus, slot_nr,
  name, NULL);
-   if (!hpdev->pci_slot)
+   if (IS_ERR(hpdev->pci_slot)) {
pr_warn("pci_create slot %s failed\n", name);
+   hpdev->pci_slot = NULL;
+   }
}
 }

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH RESEND] PCI: hv: Fix return value check in hv_pci_assign_slots()

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

Fixes: a15f2c08c708 ("PCI: hv: support reporting serial number as slot 
information")
Signed-off-by: Wei Yongjun 
---
Since the orig patch is merged from net tree, cc net...@vger.kernel.org
---
 drivers/pci/controller/pci-hyperv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/pci-hyperv.c 
b/drivers/pci/controller/pci-hyperv.c
index ee80e79..9ba4d12 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -1484,8 +1484,10 @@ static void hv_pci_assign_slots(struct hv_pcibus_device 
*hbus)
snprintf(name, SLOT_NAME_SIZE, "%u", hpdev->desc.ser);
hpdev->pci_slot = pci_create_slot(hbus->pci_bus, slot_nr,
  name, NULL);
-   if (!hpdev->pci_slot)
+   if (IS_ERR(hpdev->pci_slot)) {
pr_warn("pci_create slot %s failed\n", name);
+   hpdev->pci_slot = NULL;
+   }
}
 }

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[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) {

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] binderfs: fix error return code in binderfs_fill_super()

2019-01-15 Thread Wei Yongjun
Fix to return a negative error code -ENOMEM from the new_inode() and
d_make_root() error handling cases instead of 0, as done elsewhere in
this function.

Fixes: 3ad20fe393b3 ("binder: implement binderfs")
Signed-off-by: Wei Yongjun 
---
 drivers/android/binderfs.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
index 9518e2e..2bf4b2b 100644
--- a/drivers/android/binderfs.c
+++ b/drivers/android/binderfs.c
@@ -519,8 +519,10 @@ static int binderfs_fill_super(struct super_block *sb, 
void *data, int silent)
sb->s_fs_info = info;
 
inode = new_inode(sb);
-   if (!inode)
+   if (!inode) {
+   ret = -ENOMEM;
goto err_without_dentry;
+   }
 
inode->i_ino = FIRST_INODE;
inode->i_fop = &simple_dir_operations;
@@ -530,8 +532,10 @@ static int binderfs_fill_super(struct super_block *sb, 
void *data, int silent)
set_nlink(inode, 2);
 
sb->s_root = d_make_root(inode);
-   if (!sb->s_root)
+   if (!sb->s_root) {
+   ret = -ENOMEM;
goto err_without_dentry;
+   }
 
ret = binderfs_binder_ctl_create(sb);
if (ret)



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next v2] binderfs: fix error return code in binderfs_fill_super()

2019-01-16 Thread Wei Yongjun
Fix to return a negative error code -ENOMEM from the new_inode() and
d_make_root() error handling cases instead of 0, as done elsewhere in
this function.

Fixes: 3ad20fe393b3 ("binder: implement binderfs")
Signed-off-by: Wei Yongjun 
---
v1 -> v2: move 'ret = -ENOMEM' out of if
---
 drivers/android/binderfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
index 9518e2e..e4ff4c3 100644
--- a/drivers/android/binderfs.c
+++ b/drivers/android/binderfs.c
@@ -518,6 +518,7 @@ static int binderfs_fill_super(struct super_block *sb, void 
*data, int silent)
 
sb->s_fs_info = info;
 
+   ret = -ENOMEM;
inode = new_inode(sb);
if (!inode)
goto err_without_dentry;



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] binderfs: fix error return code in binderfs_fill_super()

2019-01-16 Thread Wei Yongjun
Fix to return a negative error code -ENOMEM from the new_inode() and
d_make_root() error handling cases instead of 0, as done elsewhere in
this function.

Fixes: 849d540ddfcd ("binderfs: implement "max" mount option")
Signed-off-by: Wei Yongjun 
---
v1 -> v2: move 'ret = -ENOMEM' out of if
v2 -> v3: use correct fixes commit
---
 drivers/android/binderfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
index 9518e2e..e4ff4c3 100644
--- a/drivers/android/binderfs.c
+++ b/drivers/android/binderfs.c
@@ -518,6 +518,7 @@ static int binderfs_fill_super(struct super_block *sb, void 
*data, int silent)
 
sb->s_fs_info = info;
 
+   ret = -ENOMEM;
inode = new_inode(sb);
if (!inode)
goto err_without_dentry;



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4] binderfs: fix error return code in binderfs_fill_super()

2019-01-16 Thread Wei Yongjun
Fix to return a negative error code -ENOMEM from the new_inode() and
d_make_root() error handling cases instead of 0, as done elsewhere in
this function.

Fixes: 849d540ddfcd ("binderfs: implement "max" mount option")
Signed-off-by: Wei Yongjun 
Reviewed-by: Christian Brauner 
---
v1 -> v2: move 'ret = -ENOMEM' out of if
v2 -> v3: use correct fixes commit
v3 -> v4: add reviewed-by
---
 drivers/android/binderfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
index 9518e2e..e4ff4c3 100644
--- a/drivers/android/binderfs.c
+++ b/drivers/android/binderfs.c
@@ -518,6 +518,7 @@ static int binderfs_fill_super(struct super_block *sb, void 
*data, int silent)
 
sb->s_fs_info = info;
 
+   ret = -ENOMEM;
inode = new_inode(sb);
if (!inode)
goto err_without_dentry;



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

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

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

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



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: Fix error return code in vboxsf_fill_super()

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

Fixes: df4028658f9d ("staging: Add VirtualBox guest shared folder (vboxsf) 
support")
Signed-off-by: Wei Yongjun 
---
 drivers/staging/vboxsf/super.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/vboxsf/super.c b/drivers/staging/vboxsf/super.c
index 3913ffafa83b..0bf4d724aefd 100644
--- a/drivers/staging/vboxsf/super.c
+++ b/drivers/staging/vboxsf/super.c
@@ -176,8 +176,10 @@ static int vboxsf_fill_super(struct super_block *sb, 
struct fs_context *fc)
/* Turn source into a shfl_string and map the folder */
size = strlen(fc->source) + 1;
folder_name = kmalloc(SHFLSTRING_HEADER_SIZE + size, GFP_KERNEL);
-   if (!folder_name)
+   if (!folder_name) {
+   err = -ENOMEM;
goto fail_free;
+   }
folder_name->size = size;
folder_name->length = size - 1;
strlcpy(folder_name->string.utf8, fc->source, size);



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[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;
}
 



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[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);

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH net-next] hv_netvsc: fix error return code in netvsc_probe()

2018-05-30 Thread Wei Yongjun
Fix to return a negative error code from the failover register fail
error handling case instead of 0, as done elsewhere in this function.

Fixes: 1ff78076d8dd ("netvsc: refactor notifier/event handling code to use the 
failover framework")
Signed-off-by: Wei Yongjun 
---
 drivers/net/hyperv/netvsc_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index ebe9642..bef4d55 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -2031,8 +2031,10 @@ static int netvsc_probe(struct hv_device *dev,
}
 
net_device_ctx->failover = failover_register(net, &netvsc_failover_ops);
-   if (IS_ERR(net_device_ctx->failover))
+   if (IS_ERR(net_device_ctx->failover)) {
+   ret = PTR_ERR(net_device_ctx->failover);
goto err_failover;
+   }
 
return ret;

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

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

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

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



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

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

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

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



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

2020-05-06 Thread Wei Yongjun



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

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

Regards,
Wei Yongjun
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

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

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

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



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] [media] staging: media: lirc: add missing platform_device_del() on error in lirc_parallel_init()

2016-07-19 Thread Wei Yongjun
From: Wei Yongjun 

Add the missing platform_device_del() before return from
lirc_parallel_init() in the error handling case.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/media/lirc/lirc_parallel.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_parallel.c 
b/drivers/staging/media/lirc/lirc_parallel.c
index 3906ac6..878fdea 100644
--- a/drivers/staging/media/lirc/lirc_parallel.c
+++ b/drivers/staging/media/lirc/lirc_parallel.c
@@ -650,7 +650,7 @@ static int __init lirc_parallel_init(void)
if (!pport) {
pr_notice("no port at %x found\n", io);
result = -ENXIO;
-   goto exit_device_put;
+   goto exit_device_del;
}
ppdevice = parport_register_device(pport, LIRC_DRIVER_NAME,
   pf, kf, lirc_lirc_irq_handler, 0,
@@ -659,7 +659,7 @@ static int __init lirc_parallel_init(void)
if (!ppdevice) {
pr_notice("parport_register_device() failed\n");
result = -ENXIO;
-   goto exit_device_put;
+   goto exit_device_del;
}
if (parport_claim(ppdevice) != 0)
goto skip_init;
@@ -678,7 +678,7 @@ static int __init lirc_parallel_init(void)
parport_release(pport);
parport_unregister_device(ppdevice);
result = -EIO;
-   goto exit_device_put;
+   goto exit_device_del;
}
 
 #endif
@@ -695,11 +695,13 @@ static int __init lirc_parallel_init(void)
pr_notice("register_chrdev() failed\n");
parport_unregister_device(ppdevice);
result = -EIO;
-   goto exit_device_put;
+   goto exit_device_del;
}
pr_info("installed using port 0x%04x irq %d\n", io, irq);
return 0;
 
+exit_device_del:
+   platform_device_del(lirc_parallel_dev);
 exit_device_put:
platform_device_put(lirc_parallel_dev);
 exit_driver_unregister:




___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] PCI: hv: Use list_move_tail instead of list_del/list_add_tail

2016-07-28 Thread Wei Yongjun
Using list_move_tail() instead of list_del() + list_add_tail().

Signed-off-by: Wei Yongjun 
---
 drivers/pci/host/pci-hyperv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index 6955ffdb..a8deeca 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -1466,8 +1466,7 @@ static void pci_devices_present_work(struct work_struct 
*work)
if (hpdev->reported_missing) {
found = true;
put_pcichild(hpdev, hv_pcidev_ref_childlist);
-   list_del(&hpdev->list_entry);
-   list_add_tail(&hpdev->list_entry, &removed);
+   list_move_tail(&hpdev->list_entry, &removed);
break;
}
}



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: comedi: dt2811: fix non static symbol warnings

2016-08-23 Thread Wei Yongjun
From: Wei Yongjun 

Fixes the following sparse warnings:

drivers/staging/comedi/drivers/dt2811.c:99:20: warning:
 symbol 'dt2811_clk_dividers' was not declared. Should it be static?
drivers/staging/comedi/drivers/dt2811.c:103:20: warning:
 symbol 'dt2811_clk_multipliers' was not declared. Should it be static?

Signed-off-by: Wei Yongjun 
---
 drivers/staging/comedi/drivers/dt2811.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt2811.c 
b/drivers/staging/comedi/drivers/dt2811.c
index 8bbd938..fcd8547 100644
--- a/drivers/staging/comedi/drivers/dt2811.c
+++ b/drivers/staging/comedi/drivers/dt2811.c
@@ -96,11 +96,11 @@
  *6  6  100 kHz 6   100
  *7 12   50 kHz 7   1000
  */
-const unsigned int dt2811_clk_dividers[] = {
+static const unsigned int dt2811_clk_dividers[] = {
1, 10, 2, 3, 4, 5, 6, 12
 };
 
-const unsigned int dt2811_clk_multipliers[] = {
+static const unsigned int dt2811_clk_multipliers[] = {
1, 10, 100, 1000, 1, 10, 100, 1000
 };
 



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: rtl8188eu: fix missing unlock on error in rtw_resume_process()

2016-08-26 Thread Wei Yongjun
From: Wei Yongjun 

Add the missing unlock before return from function
rtw_resume_process() in the error handling case.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index a5ba1e4..7da3534 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -315,8 +315,10 @@ static int rtw_resume_process(struct adapter *padapter)
 
ret = 0;
 exit:
-   if (pwrpriv)
+   if (pwrpriv) {
pwrpriv->bInSuspend = false;
+   mutex_unlock(&pwrpriv->mutex_lock);
+   }
pr_debug("<===  %s return %d.. in %dms\n", __func__,
ret, jiffies_to_msecs(jiffies - start_time));

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: fsl-mc: convert to use ATTRIBUTE_GROUPS macro

2016-08-28 Thread Wei Yongjun
From: Wei Yongjun 

Use ATTRIBUTE_GROUPS macro to reduce the number of lines of code.

Generated by Coccinelle semantic patch.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/fsl-mc/bus/mc-bus.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c 
b/drivers/staging/fsl-mc/bus/mc-bus.c
index fe20c5d..cfe3ecb 100644
--- a/drivers/staging/fsl-mc/bus/mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/mc-bus.c
@@ -101,14 +101,8 @@ static struct attribute *fsl_mc_dev_attrs[] = {
NULL,
 };
 
-static const struct attribute_group fsl_mc_dev_group = {
-   .attrs = fsl_mc_dev_attrs,
-};
+ATTRIBUTE_GROUPS(fsl_mc_dev);
 
-static const struct attribute_group *fsl_mc_dev_groups[] = {
-   &fsl_mc_dev_group,
-   NULL,
-};
 
 struct bus_type fsl_mc_bus_type = {
.name = "fsl-mc",

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: android: ion: Fix return value check in hi6220_ion_probe()

2016-09-14 Thread Wei Yongjun
From: Wei Yongjun 

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

Signed-off-by: Wei Yongjun 
---
 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/hisilicon/hi6220_ion.c 
b/drivers/staging/android/ion/hisilicon/hi6220_ion.c
index f392db2..659aa71 100644
--- a/drivers/staging/android/ion/hisilicon/hi6220_ion.c
+++ b/drivers/staging/android/ion/hisilicon/hi6220_ion.c
@@ -49,8 +49,8 @@ static int hi6220_ion_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ipdev);
 
ipdev->idev = ion_device_create(NULL);
-   if (!ipdev->idev)
-   return -ENOMEM;
+   if (IS_ERR(ipdev->idev))
+   return PTR_ERR(ipdev->idev);
 
ipdev->data = ion_parse_dt(pdev, hisi_heaps);
if (IS_ERR(ipdev->data))



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: fsl-mc: use list_del_init instead of list_del/INIT_LIST_HEAD

2016-09-14 Thread Wei Yongjun
From: Wei Yongjun 

Using list_del_init() instead of list_del() + INIT_LIST_HEAD().

Signed-off-by: Wei Yongjun 
---
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
index 2004fa7..1e06d28 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
@@ -142,8 +142,7 @@ static int __must_check 
fsl_mc_resource_pool_remove_device(struct fsl_mc_device
goto out_unlock;
}
 
-   list_del(&resource->node);
-   INIT_LIST_HEAD(&resource->node);
+   list_del_init(&resource->node);
res_pool->free_count--;
res_pool->max_count--;
 
@@ -220,8 +219,7 @@ int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus 
*mc_bus,
res_pool->free_count > res_pool->max_count))
goto out_unlock;
 
-   list_del(&resource->node);
-   INIT_LIST_HEAD(&resource->node);
+   list_del_init(&resource->node);
 
res_pool->free_count--;
error = 0;



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: fsl-mc: remove .owner field for driver

2016-09-14 Thread Wei Yongjun
From: Wei Yongjun 

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

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

Signed-off-by: Wei Yongjun 
---
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
index 2004fa7..1a35cfb 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
@@ -652,7 +652,6 @@ static const struct fsl_mc_device_id match_id_table[] = {
 static struct fsl_mc_driver fsl_mc_allocator_driver = {
.driver = {
   .name = "fsl_mc_allocator",
-  .owner = THIS_MODULE,
   .pm = NULL,
   },
.match_id_table = match_id_table,



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: rtl8712: fix double lock bug in SetPSModeWorkItemCallback()

2016-09-15 Thread Wei Yongjun
From: Wei Yongjun 

Fix a double lock bug in SetPSModeWorkItemCallback().

Fixes: 5c2ba8b85e35 ("rtl8712: pwrctrl_priv: Replace semaphore lock
with mutex")
Signed-off-by: Wei Yongjun 
---
 drivers/staging/rtl8712/rtl871x_pwrctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl871x_pwrctrl.c 
b/drivers/staging/rtl8712/rtl871x_pwrctrl.c
index 8f82d85..d464c13 100644
--- a/drivers/staging/rtl8712/rtl871x_pwrctrl.c
+++ b/drivers/staging/rtl8712/rtl871x_pwrctrl.c
@@ -145,7 +145,7 @@ static void SetPSModeWorkItemCallback(struct work_struct 
*work)
mutex_lock(&pwrpriv->mutex_lock);
if (pwrpriv->pwr_mode == PS_MODE_ACTIVE)
r8712_set_rpwm(padapter, PS_STATE_S4);
-   mutex_lock(&pwrpriv->mutex_lock);
+   mutex_unlock(&pwrpriv->mutex_lock);
}
 }

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: ks7010: remove unused including

2016-09-15 Thread Wei Yongjun
From: Wei Yongjun 

Remove including  that don't need it.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/ks7010/ks_wlan_net.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
b/drivers/staging/ks7010/ks_wlan_net.c
index a35325e..c17c45d 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -9,7 +9,6 @@
  *   published by the Free Software Foundation.
  */
 
-#include 
 #include 
 #include 
 #include 



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] vme: fake: remove unexpected unlock in fake_master_set()

2016-09-16 Thread Wei Yongjun
From: Wei Yongjun 

image->lock is unlocked in some error handling path without take the
lock, so remove those unexpected unlock.

Fixes: 658bcdae9c67 ("vme: Adding Fake VME driver")
Signed-off-by: Wei Yongjun 
---
 drivers/vme/bridges/vme_fake.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/vme/bridges/vme_fake.c b/drivers/vme/bridges/vme_fake.c
index ebf35d3..4b2613d 100644
--- a/drivers/vme/bridges/vme_fake.c
+++ b/drivers/vme/bridges/vme_fake.c
@@ -273,7 +273,6 @@ static int fake_master_set(struct vme_master_resource 
*image, int enabled,
}
 
if (size & 0x) {
-   spin_unlock(&image->lock);
pr_err("Invalid size alignment\n");
retval = -EINVAL;
goto err_window;
@@ -292,7 +291,6 @@ static int fake_master_set(struct vme_master_resource 
*image, int enabled,
case VME_D32:
break;
default:
-   spin_unlock(&image->lock);
pr_err("Invalid data width\n");
retval = -EINVAL;
goto err_dwidth;
@@ -311,7 +309,6 @@ static int fake_master_set(struct vme_master_resource 
*image, int enabled,
case VME_USER4:
break;
default:
-   spin_unlock(&image->lock);
pr_err("Invalid address space\n");
retval = -EINVAL;
goto err_aspace;

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: most: fix error return code in audio_probe_channel()

2016-09-25 Thread Wei Yongjun
From: Wei Yongjun 

Fix to return a negative error code from the audio_set_hw_params() error
handling case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/most/aim-sound/sound.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index 3dc625c..00f01c9 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -607,7 +607,8 @@ static int audio_probe_channel(struct most_interface 
*iface, int channel_id,
channel->id = channel_id;
init_waitqueue_head(&channel->playback_waitq);
 
-   if (audio_set_hw_params(&channel->pcm_hardware, pcm_format, cfg))
+   ret = audio_set_hw_params(&channel->pcm_hardware, pcm_format, cfg);
+   if (ret)
goto err_free_card;
 
snprintf(card->driver, sizeof(card->driver), "%s", DRIVER_NAME);

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: media: stih-cec: remove unused including

2016-09-28 Thread Wei Yongjun
From: Wei Yongjun 

Remove including  that don't need it.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/media/st-cec/stih-cec.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/media/st-cec/stih-cec.c 
b/drivers/staging/media/st-cec/stih-cec.c
index 2143448..b0aee1d 100644
--- a/drivers/staging/media/st-cec/stih-cec.c
+++ b/drivers/staging/media/st-cec/stih-cec.c
@@ -16,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8188eu: fix double unlock error in rtw_resume_process()

2016-09-30 Thread Wei Yongjun
Fix following static checker warning:
drivers/staging/rtl8188eu/os_dep/usb_intf.c:311 rtw_resume_process()
error: double unlock 'mutex:&pwrpriv->mutex_lock'

Fixes: eaf47b713b60 ("staging: rtl8188eu: fix missing unlock on
error in rtw_resume_process()")
Reported-By: Dan Carpenter 
Signed-off-by: Wei Yongjun 

diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index b2bc09e..68e1e6b 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -294,8 +294,10 @@ static int rtw_resume_process(struct adapter *padapter)
pwrpriv->bkeepfwalive = false;
 
pr_debug("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive);
-   if (pm_netdev_open(pnetdev, true) != 0)
+   if (pm_netdev_open(pnetdev, true) != 0) {
+   mutex_unlock(&pwrpriv->mutex_lock);
goto exit;
+   }
 
netif_device_attach(pnetdev);
netif_carrier_on(pnetdev);
@@ -306,10 +308,8 @@ static int rtw_resume_process(struct adapter *padapter)
 
ret = 0;
 exit:
-   if (pwrpriv) {
+   if (pwrpriv)
pwrpriv->bInSuspend = false;
-   mutex_unlock(&pwrpriv->mutex_lock);
-   }
pr_debug("<===  %s return %d.. in %dms\n", __func__,
ret, jiffies_to_msecs(jiffies - start_time));
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: bcm2708_vchiq: fix return value check in vchiq_init_state()

2016-10-17 Thread Wei Yongjun
From: Wei Yongjun 

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

Signed-off-by: Wei Yongjun 
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 2c98da4..8cb43f5 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -2494,7 +2494,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T 
*slot_zero,
(void *)state,
threadname);
 
-   if (state->slot_handler_thread == NULL) {
+   if (IS_ERR(state->slot_handler_thread)) {
vchiq_loud_error_header();
vchiq_loud_error("couldn't create thread %s", threadname);
vchiq_loud_error_footer();
@@ -2507,7 +2507,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T 
*slot_zero,
state->recycle_thread = kthread_create(&recycle_func,
(void *)state,
threadname);
-   if (state->recycle_thread == NULL) {
+   if (IS_ERR(state->recycle_thread)) {
vchiq_loud_error_header();
vchiq_loud_error("couldn't create thread %s", threadname);
vchiq_loud_error_footer();
@@ -2520,7 +2520,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T 
*slot_zero,
state->sync_thread = kthread_create(&sync_func,
(void *)state,
threadname);
-   if (state->sync_thread == NULL) {
+   if (IS_ERR(state->sync_thread)) {
vchiq_loud_error_header();
vchiq_loud_error("couldn't create thread %s", threadname);
vchiq_loud_error_footer();

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: bcm2708_vchiq: remove .owner field for driver

2016-10-17 Thread Wei Yongjun
From: Wei Yongjun 

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

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

Signed-off-by: Wei Yongjun 
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index e11c0e0..5370cb8 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -2891,7 +2891,6 @@ MODULE_DEVICE_TABLE(of, vchiq_of_match);
 static struct platform_driver vchiq_driver = {
.driver = {
.name = "bcm2835_vchiq",
-   .owner = THIS_MODULE,
.of_match_table = vchiq_of_match,
},
.probe = vchiq_probe,

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: bcm2708_vchiq: fix return value check in vchiq_platform_conn_state_changed()

2016-10-17 Thread Wei Yongjun
From: Wei Yongjun 

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

Signed-off-by: Wei Yongjun 
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index e11c0e0..ccd1735 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -2781,7 +2781,7 @@ void vchiq_platform_conn_state_changed(VCHIQ_STATE_T 
*state,
&vchiq_keepalive_thread_func,
(void *)state,
threadname);
-   if (arm_state->ka_thread == NULL) {
+   if (IS_ERR(arm_state->ka_thread)) {
vchiq_log_error(vchiq_susp_log_level,
"vchiq: FATAL: couldn't create thread 
%s",
threadname);

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] greybus: arche-platform: Add missing of_node_put() in arche_platform_change_state()

2016-10-17 Thread Wei Yongjun
From: Wei Yongjun 

This node pointer is returned by of_find_compatible_node() with
refcount incremented in this function. of_node_put() on it before
exitting this function.

This is detected by Coccinelle semantic patch.

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

diff --git a/drivers/staging/greybus/arche-platform.c 
b/drivers/staging/greybus/arche-platform.c
index a850f6b..389ed36 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -128,6 +128,7 @@ int arche_platform_change_state(enum arche_platform_state 
state,
pdev = of_find_device_by_node(np);
if (!pdev) {
pr_err("arche-platform device not found\n");
+   of_node_put(np);
return -ENODEV;
}
 



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: rts5208: rtsx.c: Fix invalid use of sizeof in rtsx_probe()

2016-10-17 Thread Wei Yongjun
From: Wei Yongjun 

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

Fixes: 2eb9d8cbb3c3 ("staging: rts5208: rtsx.c: Alloc sizeof struct")
Signed-off-by: Wei Yongjun 
---
 drivers/staging/rts5208/rtsx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index f3e5efd..68d75d0 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -884,7 +884,7 @@ static int rtsx_probe(struct pci_dev *pci,
dev = host_to_rtsx(host);
memset(dev, 0, sizeof(struct rtsx_dev));
 
-   dev->chip = kzalloc(sizeof(dev->chip), GFP_KERNEL);
+   dev->chip = kzalloc(sizeof(*dev->chip), GFP_KERNEL);
if (!dev->chip) {
err = -ENOMEM;
goto errout;

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: i4l: pcbit: remove duplicated include from capi.c

2016-10-18 Thread Wei Yongjun
From: Wei Yongjun 

Remove duplicated include.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/i4l/pcbit/capi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/i4l/pcbit/capi.c b/drivers/staging/i4l/pcbit/capi.c
index 91f2994..a6c4e00 100644
--- a/drivers/staging/i4l/pcbit/capi.c
+++ b/drivers/staging/i4l/pcbit/capi.c
@@ -27,7 +27,6 @@
  *  encode our number in CallerPN and ConnectedPN
  */
 
-#include 
 #include 
 
 #include 



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: i4l: pcbit: drv: remove duplicated include from drv.c

2016-10-18 Thread Wei Yongjun
From: Wei Yongjun 

Remove duplicated include.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/i4l/pcbit/drv.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/i4l/pcbit/drv.c b/drivers/staging/i4l/pcbit/drv.c
index 87b8522..89b0b5b 100644
--- a/drivers/staging/i4l/pcbit/drv.c
+++ b/drivers/staging/i4l/pcbit/drv.c
@@ -27,7 +27,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: ks7010: convert list_for_each to entry variant

2016-10-18 Thread Wei Yongjun
From: Wei Yongjun 

convert list_for_each() to list_for_each_entry() where
applicable.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/ks7010/ks_hostif.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index 1f9f63e..42b53b2 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -2399,13 +2399,11 @@ void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
} __packed list[PMK_LIST_MAX];
} __packed pmkcache;
struct pmk_t *pmk;
-   struct list_head *ptr;
int i;
 
DPRINTK(4, "pmklist.size=%d\n", priv->pmklist.size);
i = 0;
-   list_for_each(ptr, &priv->pmklist.head) {
-   pmk = list_entry(ptr, struct pmk_t, list);
+   list_for_each_entry(pmk, &priv->pmklist.head, list) {
if (i < PMK_LIST_MAX) {
memcpy(pmkcache.list[i].bssid, pmk->bssid, ETH_ALEN);
memcpy(pmkcache.list[i].pmkid, pmk->pmkid,



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: ks7010: ks_wlan_net: Use setup_timer instead of init_timer and data fields

2016-10-18 Thread Wei Yongjun
From: Wei Yongjun 

Use setup_timer function instead of initializing timer with the function
and data fields

Signed-off-by: Wei Yongjun 
---
 drivers/staging/ks7010/ks_wlan_net.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
b/drivers/staging/ks7010/ks_wlan_net.c
index 7b864c0..3c58f84 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -3460,9 +3460,8 @@ int ks_wlan_net_start(struct net_device *dev)
 
/* phy information update timer */
atomic_set(&update_phyinfo, 0);
-   init_timer(&update_phyinfo_timer);
-   update_phyinfo_timer.function = ks_wlan_update_phyinfo_timeout;
-   update_phyinfo_timer.data = (unsigned long)priv;
+   setup_timer(&update_phyinfo_timer, ks_wlan_update_phyinfo_timeout,
+   (unsigned long)priv);
 
/* dummy address set */
memcpy(priv->eth_addr, dummy_addr, ETH_ALEN);



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: ks7010: remove unused including

2016-10-18 Thread Wei Yongjun
From: Wei Yongjun 

Remove including  that don't need it.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/ks7010/ks_wlan.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index 5851714..6981170 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -14,7 +14,6 @@
 
 #define WPS
 
-#include 
 #include 
 #include 
 #include 



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH -next] staging: i4l: pcbit: remove duplicated include from capi.c

2016-10-18 Thread Wei Yongjun
Hi Alexander,


On 10/18/2016 11:30 PM, Alexander Alemayhu wrote:
> On Tue, Oct 18, 2016 at 02:37:10PM +0000, Wei Yongjun wrote:
>> From: Wei Yongjun 
>>
>> Remove duplicated include.
>>
> How did you discover that? Just curious if you used any tooling.
>
I found those using my dpatch tool, which integrated sparse, coccinelle
and some scripts. check changed files every day. It is available at:
https://github.com/weiyj/dpatch

Regards,
Yongjun Wei
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] greybus: es2: fix error return code in ap_probe()

2016-10-19 Thread Wei Yongjun
From: Wei Yongjun 

Fix to return a negative error code from the es2_arpc_in_enable() error
handling case instead of 0, as done elsewhere in this function.

Fixes: 9d9d3777a9db ("greybus: es2: Add a new bulk in endpoint for
APBridgeA RPC")
Signed-off-by: Wei Yongjun 
---
 drivers/staging/greybus/es2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c
index 8eabc71..a97fccf 100644
--- a/drivers/staging/greybus/es2.c
+++ b/drivers/staging/greybus/es2.c
@@ -1547,7 +1547,8 @@ static int ap_probe(struct usb_interface *interface,
INIT_LIST_HEAD(&es2->arpcs);
spin_lock_init(&es2->arpc_lock);
 
-   if (es2_arpc_in_enable(es2))
+   retval = es2_arpc_in_enable(es2);
+   if (retval)
goto error;
 
retval = gb_hd_add(hd);

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] [media] s5p-cec: remove unused including

2016-10-29 Thread Wei Yongjun
From: Wei Yongjun 

Remove including  that don't need it.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/media/s5p-cec/s5p_cec.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/media/s5p-cec/s5p_cec.c 
b/drivers/staging/media/s5p-cec/s5p_cec.c
index 1780a08..aef962b 100644
--- a/drivers/staging/media/s5p-cec/s5p_cec.c
+++ b/drivers/staging/media/s5p-cec/s5p_cec.c
@@ -22,7 +22,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: crystalhd: use vfree() instead of kfree()

2013-10-10 Thread Wei Yongjun
From: Wei Yongjun 

Use vfree() instead of kfree() to free vmalloc()
allocated data.

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

diff --git a/drivers/staging/crystalhd/crystalhd_lnx.c 
b/drivers/staging/crystalhd/crystalhd_lnx.c
index b17fbf8..e0c28ed 100644
--- a/drivers/staging/crystalhd/crystalhd_lnx.c
+++ b/drivers/staging/crystalhd/crystalhd_lnx.c
@@ -156,7 +156,7 @@ static int chd_dec_fetch_cdata(struct crystalhd_adp *adp,
if (rc) {
BCMLOG_ERR("failed to pull add_cdata sz:%x ua_off:%x\n",
   io->add_cdata_sz, (unsigned int)ua_off);
-   kfree(io->add_cdata);
+   vfree(io->add_cdata);
io->add_cdata = NULL;
return -ENODATA;
}

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: sep: add missing misc_deregister() on error in sep_register_driver_with_fs()

2013-10-20 Thread Wei Yongjun
From: Wei Yongjun 

Add the missing misc_deregister() before return from
sep_register_driver_with_fs() in the error handling case.

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

diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c
index 11f5b21..5f8c0a8 100644
--- a/drivers/staging/sep/sep_main.c
+++ b/drivers/staging/sep/sep_main.c
@@ -4075,6 +4075,7 @@ static int sep_register_driver_with_fs(struct sep_device 
*sep)
if (ret_val) {
dev_warn(&sep->pdev->dev, "sysfs attribute1 fails for SEP %x\n",
ret_val);
+   misc_deregister(&sep->miscdev_sep);
return ret_val;
}
 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: drm/imx: fix return value check in imx_drm_init()

2013-10-25 Thread Wei Yongjun
From: Wei Yongjun 

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().

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

diff --git a/drivers/staging/imx-drm/imx-drm-core.c 
b/drivers/staging/imx-drm/imx-drm-core.c
index a2e52a0..835a1b1 100644
--- a/drivers/staging/imx-drm/imx-drm-core.c
+++ b/drivers/staging/imx-drm/imx-drm-core.c
@@ -837,8 +837,8 @@ static int __init imx_drm_init(void)
INIT_LIST_HEAD(&imx_drm_device->encoder_list);
 
imx_drm_pdev = platform_device_register_simple("imx-drm", -1, NULL, 0);
-   if (!imx_drm_pdev) {
-   ret = -EINVAL;
+   if (IS_ERR(imx_drm_pdev)) {
+   ret = PTR_ERR(imx_drm_pdev);
goto err_pdev;
}
 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: drm/imx: fix return value check in ipu_add_subdevice_pdata()

2013-10-29 Thread Wei Yongjun
From: Wei Yongjun 

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

Signed-off-by: Wei Yongjun 
---
 drivers/staging/imx-drm/ipu-v3/ipu-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-common.c 
b/drivers/staging/imx-drm/ipu-v3/ipu-common.c
index 77a0c65..36afc48 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-common.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-common.c
@@ -1006,7 +1006,7 @@ static int ipu_add_subdevice_pdata(struct device *dev,
pdev = platform_device_register_data(dev, reg->name, ipu_client_id++,
®->pdata, sizeof(struct ipu_platform_reg));
 
-   return pdev ? 0 : -EINVAL;
+   return PTR_ERR_OR_ZERO(pdev);
 }
 
 static int ipu_add_client_devices(struct ipu_soc *ipu)

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: rts5208: fix error return code in rtsx_probe()

2013-11-26 Thread Wei Yongjun
From: Wei Yongjun 

Fix to return -ENOMEM instead of 0 when the memory alloc fail
in probe error handling path.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/rts5208/rtsx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index 7882f57..8586ac5 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -896,8 +896,10 @@ static int rtsx_probe(struct pci_dev *pci,
memset(dev, 0, sizeof(struct rtsx_dev));
 
dev->chip = kzalloc(sizeof(struct rtsx_chip), GFP_KERNEL);
-   if (dev->chip == NULL)
+   if (dev->chip == NULL) {
+   err = -ENOMEM;
goto errout;
+   }
 
spin_lock_init(&dev->reg_lock);
mutex_init(&(dev->dev_mutex));

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: dwc2: fix sparse non static symbol warning

2013-11-27 Thread Wei Yongjun
From: Wei Yongjun 

Fixes the following sparse warning:

drivers/staging/dwc2/core.c:2672:6: warning:
 symbol 'dwc2_set_param_uframe_sched' was not declared. Should it be static?

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

diff --git a/drivers/staging/dwc2/core.c b/drivers/staging/dwc2/core.c
index c0b122a..ffc3fa7 100644
--- a/drivers/staging/dwc2/core.c
+++ b/drivers/staging/dwc2/core.c
@@ -2669,7 +2669,7 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
return 0;
 }
 
-void dwc2_set_param_uframe_sched(struct dwc2_hsotg *hsotg, int val)
+static void dwc2_set_param_uframe_sched(struct dwc2_hsotg *hsotg, int val)
 {
if (DWC2_OUT_OF_BOUNDS(val, 0, 1)) {
if (val >= 0) {

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] [media] radio-bcm2048: fix missing unlock on error in bcm2048_rds_fifo_receive()

2013-12-11 Thread Wei Yongjun
From: Wei Yongjun 

Add the missing unlock before return from function bcm2048_rds_fifo_receive()
in the error handling case.

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

diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c 
b/drivers/staging/media/bcm2048/radio-bcm2048.c
index 494ec39..37ff899 100644
--- a/drivers/staging/media/bcm2048/radio-bcm2048.c
+++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
@@ -1767,6 +1767,7 @@ static void bcm2048_rds_fifo_receive(struct 
bcm2048_device *bdev)
bdev->rds_info.radio_text, bdev->fifo_size);
if (err != 2) {
dev_err(&bdev->client->dev, "RDS Read problem\n");
+   mutex_unlock(&bdev->mutex);
return;
}
 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: xillybus: fix error return code in xilly_probe()

2013-12-15 Thread Wei Yongjun
From: Wei Yongjun 

Fix to return negative error code -EIO from the error handling
case instead of 0.

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

diff --git a/drivers/staging/xillybus/xillybus_pcie.c 
b/drivers/staging/xillybus/xillybus_pcie.c
index 0564f97..51426d8 100644
--- a/drivers/staging/xillybus/xillybus_pcie.c
+++ b/drivers/staging/xillybus/xillybus_pcie.c
@@ -168,9 +168,9 @@ static int xilly_probe(struct pci_dev *pdev,
}
 
endpoint->registers = pci_iomap(pdev, 0, 128);
-
if (!endpoint->registers) {
dev_err(endpoint->dev, "Failed to map BAR 0. Aborting.\n");
+   rc = -EIO;
goto failed_iomap0;
}
 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] gpu: ion: use module_platform_driver to simplify the code

2013-12-16 Thread Wei Yongjun
From: Wei Yongjun 

module_platform_driver() makes the code simpler by eliminating
boilerplate code.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/android/ion/tegra/tegra_ion.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/staging/android/ion/tegra/tegra_ion.c 
b/drivers/staging/android/ion/tegra/tegra_ion.c
index 0849600..4b3d93f 100644
--- a/drivers/staging/android/ion/tegra/tegra_ion.c
+++ b/drivers/staging/android/ion/tegra/tegra_ion.c
@@ -81,16 +81,5 @@ static struct platform_driver ion_driver = {
.driver = { .name = "ion-tegra" }
 };
 
-static int __init ion_init(void)
-{
-   return platform_driver_register(&ion_driver);
-}
-
-static void __exit ion_exit(void)
-{
-   platform_driver_unregister(&ion_driver);
-}
-
-module_init(ion_init);
-module_exit(ion_exit);
+module_platform_driver(ion_driver);
 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] gpu: ion: fix sparse non static symbol warnings

2013-12-16 Thread Wei Yongjun
From: Wei Yongjun 

Fixes the following sparse warnings:

drivers/staging/android/ion/tegra/tegra_ion.c:23:19: warning:
 symbol 'idev' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:24:19: warning:
 symbol 'tegra_user_mapper' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:25:5: warning:
 symbol 'num_heaps' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:26:17: warning:
 symbol 'heaps' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:28:5: warning:
 symbol 'tegra_ion_probe' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:66:5: warning:
 symbol 'tegra_ion_remove' was not declared. Should it be static?

Signed-off-by: Wei Yongjun 
---
 drivers/staging/android/ion/tegra/tegra_ion.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/android/ion/tegra/tegra_ion.c 
b/drivers/staging/android/ion/tegra/tegra_ion.c
index 0849600..b3c4707 100644
--- a/drivers/staging/android/ion/tegra/tegra_ion.c
+++ b/drivers/staging/android/ion/tegra/tegra_ion.c
@@ -20,12 +20,11 @@
 #include "../ion.h"
 #include "../ion_priv.h"
 
-struct ion_device *idev;
-struct ion_mapper *tegra_user_mapper;
-int num_heaps;
-struct ion_heap **heaps;
+static struct ion_device *idev;
+static int num_heaps;
+static struct ion_heap **heaps;
 
-int tegra_ion_probe(struct platform_device *pdev)
+static int tegra_ion_probe(struct platform_device *pdev)
 {
struct ion_platform_data *pdata = pdev->dev.platform_data;
int err;
@@ -63,7 +62,7 @@ err:
return err;
 }
 
-int tegra_ion_remove(struct platform_device *pdev)
+static int tegra_ion_remove(struct platform_device *pdev)
 {
struct ion_device *idev = platform_get_drvdata(pdev);
int i;

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: sep: add missing destroy_workqueue() in sep_crypto.c

2013-12-19 Thread Wei Yongjun
From: Wei Yongjun 

Add the missing destroy_workqueue() before return from
sep_crypto_setup() and sep_crypto_takedown().

Signed-off-by: Wei Yongjun 
---
 drivers/staging/sep/sep_crypto.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/sep/sep_crypto.c b/drivers/staging/sep/sep_crypto.c
index b9262a7..1c62101 100644
--- a/drivers/staging/sep/sep_crypto.c
+++ b/drivers/staging/sep/sep_crypto.c
@@ -3927,6 +3927,7 @@ int sep_crypto_setup(void)
 err_algs:
for (k = 0; k < i; k++)
crypto_unregister_ahash(&hash_algs[k]);
+   destroy_workqueue(sep_dev->workqueue);
return err;
 
 err_crypto_algs:
@@ -3945,6 +3946,7 @@ void sep_crypto_takedown(void)
for (i = 0; i < ARRAY_SIZE(crypto_algs); i++)
crypto_unregister_alg(&crypto_algs[i]);
 
+   destroy_workqueue(sep_dev->workqueue);
tasklet_kill(&sep_dev->finish_tasklet);
 }
 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: lustre: fix return value check in capa_hmac()

2013-12-19 Thread Wei Yongjun
From: Wei Yongjun 

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

Signed-off-by: Wei Yongjun 
---
 drivers/staging/lustre/lustre/obdclass/capa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/capa.c 
b/drivers/staging/lustre/lustre/obdclass/capa.c
index 68d797b..039232d 100644
--- a/drivers/staging/lustre/lustre/obdclass/capa.c
+++ b/drivers/staging/lustre/lustre/obdclass/capa.c
@@ -273,10 +273,10 @@ int capa_hmac(__u8 *hmac, struct lustre_capa *capa, __u8 
*key)
alg = &capa_hmac_algs[capa_alg(capa)];
 
tfm = crypto_alloc_hash(alg->ha_name, 0, 0);
-   if (!tfm) {
+   if (IS_ERR(tfm)) {
CERROR("crypto_alloc_tfm failed, check whether your kernel"
   "has crypto support!\n");
-   return -ENOMEM;
+   return PTR_ERR(tfm);
}
keylen = alg->ha_keylen;
 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] Staging: silicom: fix sparse non static symbol warnings

2013-12-23 Thread Wei Yongjun
From: Wei Yongjun 

Fixes the following sparse warnings:

drivers/staging/silicom/bypasslib/bypass.c:528:12: warning:
 symbol 'init_lib_module' was not declared. Should it be static?
drivers/staging/silicom/bypasslib/bypass.c:534:13: warning:
 symbol 'cleanup_lib_module' was not declared. Should it be static?

Signed-off-by: Wei Yongjun 
---
 drivers/staging/silicom/bypasslib/bypass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/silicom/bypasslib/bypass.c 
b/drivers/staging/silicom/bypasslib/bypass.c
index 9b771c9..09e00da 100644
--- a/drivers/staging/silicom/bypasslib/bypass.c
+++ b/drivers/staging/silicom/bypasslib/bypass.c
@@ -525,13 +525,13 @@ static int get_bypass_info(int if_index, struct bp_info 
*bp_info)
 }
 EXPORT_SYMBOL(get_bypass_info);
 
-int __init init_lib_module(void)
+static int __init init_lib_module(void)
 {
printk(VERSION);
return 0;
 }
 
-void __exit cleanup_lib_module(void)
+static void __exit cleanup_lib_module(void)
 {
 }
 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] ion: Fix sparse non static symbol warnings

2014-01-13 Thread Wei Yongjun
From: Wei Yongjun 

Fixes the following sparse warnings:

drivers/staging/android/ion/ion_dummy_driver.c:26:19: warning:
 symbol 'idev' was not declared. Should it be static?
drivers/staging/android/ion/ion_dummy_driver.c:27:17: warning:
 symbol 'heaps' was not declared. Should it be static?
drivers/staging/android/ion/ion_dummy_driver.c:29:6: warning:
 symbol 'carveout_ptr' was not declared. Should it be static?
drivers/staging/android/ion/ion_dummy_driver.c:30:6: warning:
 symbol 'chunk_ptr' was not declared. Should it be static?
drivers/staging/android/ion/ion_dummy_driver.c:32:26: warning:
 symbol 'dummy_heaps' was not declared. Should it be static?
drivers/staging/android/ion/ion_dummy_driver.c:59:26: warning:
 symbol 'dummy_ion_pdata' was not declared. Should it be static?

Signed-off-by: Wei Yongjun 
---
 drivers/staging/android/ion/ion_dummy_driver.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/android/ion/ion_dummy_driver.c 
b/drivers/staging/android/ion/ion_dummy_driver.c
index 55b2002..b89004a 100644
--- a/drivers/staging/android/ion/ion_dummy_driver.c
+++ b/drivers/staging/android/ion/ion_dummy_driver.c
@@ -23,13 +23,13 @@
 #include "ion.h"
 #include "ion_priv.h"
 
-struct ion_device *idev;
-struct ion_heap **heaps;
+static struct ion_device *idev;
+static struct ion_heap **heaps;
 
-void *carveout_ptr;
-void *chunk_ptr;
+static void *carveout_ptr;
+static void *chunk_ptr;
 
-struct ion_platform_heap dummy_heaps[] = {
+static struct ion_platform_heap dummy_heaps[] = {
{
.id = ION_HEAP_TYPE_SYSTEM,
.type   = ION_HEAP_TYPE_SYSTEM,
@@ -56,7 +56,7 @@ struct ion_platform_heap dummy_heaps[] = {
},
 };
 
-struct ion_platform_data dummy_ion_pdata = {
+static struct ion_platform_data dummy_ion_pdata = {
.nr = 4,
.heaps = dummy_heaps,
 };

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: ccree: remove redundant dev_err call in init_cc_resources()

2018-01-11 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 
---
 drivers/staging/ccree/cc_driver.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/ccree/cc_driver.c 
b/drivers/staging/ccree/cc_driver.c
index 6682d9d..c27d5a8 100644
--- a/drivers/staging/ccree/cc_driver.c
+++ b/drivers/staging/ccree/cc_driver.c
@@ -174,10 +174,8 @@ static int init_cc_resources(struct platform_device 
*plat_dev)
req_mem_cc_regs = platform_get_resource(plat_dev, IORESOURCE_MEM, 0);
/* Map registers space */
new_drvdata->cc_base = devm_ioremap_resource(dev, req_mem_cc_regs);
-   if (IS_ERR(new_drvdata->cc_base)) {
-   dev_err(dev, "Failed to ioremap registers");
+   if (IS_ERR(new_drvdata->cc_base))
return PTR_ERR(new_drvdata->cc_base);
-   }
 
dev_dbg(dev, "Got MEM resource (%s): %pR\n", req_mem_cc_regs->name,
req_mem_cc_regs);

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[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 
---
 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;

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[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 
---
 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(&pdev->dev, res);
-   if (!gsw->base)
-   return -EADDRNOTAVAIL;
+   if (IS_ERR(gsw->base))
+   return PTR_ERR(gsw->base);
 
gsw->dev = &pdev->dev;
gsw->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[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 
---
 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;

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[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 
---
 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(&pdev->dev, res);
-   if (!eth->base)
-   return -EADDRNOTAVAIL;
+   if (IS_ERR(eth->base))
+   return PTR_ERR(eth->base);
 
spin_lock_init(ð->page_lock);

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

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

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

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

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

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

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: gdm724x: use GFP_ATOMIC under spin lock

2013-07-25 Thread Wei Yongjun
From: Wei Yongjun 

A spin lock is taken here so we should use GFP_ATOMIC.

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

diff --git a/drivers/staging/gdm724x/gdm_mux.c 
b/drivers/staging/gdm724x/gdm_mux.c
index f570bc0..7becf5c 100644
--- a/drivers/staging/gdm724x/gdm_mux.c
+++ b/drivers/staging/gdm724x/gdm_mux.c
@@ -410,7 +410,7 @@ static int gdm_mux_send(void *priv_dev, void *data, int 
len, int tty_index,
  gdm_mux_send_complete,
  t);
 
-   ret = usb_submit_urb(t->urb, GFP_KERNEL);
+   ret = usb_submit_urb(t->urb, GFP_ATOMIC);
 
spin_unlock_irqrestore(&mux_dev->write_lock, flags);
 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: comedi: dt9812: remove duplicated include from dt9812.c

2013-07-28 Thread Wei Yongjun
From: Wei Yongjun 

Remove duplicated include.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/comedi/drivers/dt9812.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/dt9812.c 
b/drivers/staging/comedi/drivers/dt9812.c
index ffb7572..b865367 100644
--- a/drivers/staging/comedi/drivers/dt9812.c
+++ b/drivers/staging/comedi/drivers/dt9812.c
@@ -42,7 +42,6 @@ for my needs.
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: gdm724x: remove duplicated include from gdm_lte.c

2013-07-28 Thread Wei Yongjun
From: Wei Yongjun 

Remove duplicated include.

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

diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index 68ebc7d..7165d3a 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -21,9 +21,7 @@
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
 #include 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: xillybus: remove duplicated include from xillybus_core.c

2013-07-28 Thread Wei Yongjun
From: Wei Yongjun 

Remove duplicated include.

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

diff --git a/drivers/staging/xillybus/xillybus_core.c 
b/drivers/staging/xillybus/xillybus_core.c
index dd0a71c..4b216d4 100644
--- a/drivers/staging/xillybus/xillybus_core.c
+++ b/drivers/staging/xillybus/xillybus_core.c
@@ -27,11 +27,9 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include "xillybus.h"

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] vme: vme_ca91cx42.c: fix to pass correct device identity to free_irq()

2013-08-25 Thread Wei Yongjun
From: Wei Yongjun 

free_irq() expects the same device identity that was passed to
corresponding request_irq(), otherwise the IRQ is not freed.

Signed-off-by: Wei Yongjun 
---
 drivers/vme/bridges/vme_ca91cx42.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/vme/bridges/vme_ca91cx42.c 
b/drivers/vme/bridges/vme_ca91cx42.c
index 64bfea3..f24e234 100644
--- a/drivers/vme/bridges/vme_ca91cx42.c
+++ b/drivers/vme/bridges/vme_ca91cx42.c
@@ -243,6 +243,8 @@ static int ca91cx42_irq_init(struct vme_bridge 
*ca91cx42_bridge)
 static void ca91cx42_irq_exit(struct ca91cx42_driver *bridge,
struct pci_dev *pdev)
 {
+   struct vme_bridge *ca91cx42_bridge;
+
/* Disable interrupts from PCI to VME */
iowrite32(0, bridge->base + VINT_EN);
 
@@ -251,7 +253,9 @@ static void ca91cx42_irq_exit(struct ca91cx42_driver 
*bridge,
/* Clear Any Pending PCI Interrupts */
iowrite32(0x00FF, bridge->base + LINT_STAT);
 
-   free_irq(pdev->irq, pdev);
+   ca91cx42_bridge = container_of((void *)bridge, struct vme_bridge,
+  driver_priv);
+   free_irq(pdev->irq, ca91cx42_bridge);
 }
 
 static int ca91cx42_iack_received(struct ca91cx42_driver *bridge, int level)

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Drivers: hv: vmbus: fix error return code in vmbus_connect()

2013-09-11 Thread Wei Yongjun
From: Wei Yongjun 

Fix to return -EINVAL in the version check error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun 
---
 drivers/hv/connection.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 8f4743a..b3eb50f 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -204,8 +204,10 @@ int vmbus_connect(void)
version = vmbus_get_next_version(version);
} while (version != VERSION_INVAL);
 
-   if (version == VERSION_INVAL)
+   if (version == VERSION_INVAL) {
+   ret = -EINVAL;
goto cleanup;
+   }
 
vmbus_proto_version = version;
pr_info("Hyper-V Host Build:%d-%d.%d-%d-%d.%d; Vmbus version:%d.%d\n",

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Drivers: hv: vmbus: fix error return code in vmbus_connect()

2013-09-11 Thread Wei Yongjun
On 09/12/2013 04:03 AM, KY Srinivasan wrote:
>
>> -Original Message-
>> From: Wei Yongjun [mailto:weiyj...@gmail.com]
>> Sent: Wednesday, September 11, 2013 4:20 AM
>> To: KY Srinivasan; Haiyang Zhang
>> Cc: yongjun_...@trendmicro.com.cn; de...@linuxdriverproject.org; linux-
>> ker...@vger.kernel.org
>> Subject: [PATCH] Drivers: hv: vmbus: fix error return code in vmbus_connect()
>>
>> From: Wei Yongjun 
>>
>> Fix to return -EINVAL in the version check error handling
>> case instead of 0, as done elsewhere in this function.
> The return will not be zero in this case. If you look at the function 
> vmbus_negotiate_version(), in case the host refuses the version, the
> return value will be set to -ECONNREFUSED

look at the code:

 196 do {
 197 ret = vmbus_negotiate_version(msginfo, version);
 198 if (ret)
 199 goto cleanup;
 200 
 201 if (vmbus_connection.conn_state == CONNECTED)
 202 break;
 203 
 204 version = vmbus_get_next_version(version);
 205 } while (version != VERSION_INVAL);
 206 
 207 if (version == VERSION_INVAL)
 208 goto cleanup;

if function vmbus_negotiate_version() return error, the code
will goto cleanup. 

If 'version == VERSION_INVAL' is true, I think we tried all
of the VERSION_WS2008/VERSION_WIN7/VERSION_WIN8, but still
can not get the connection.

 



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: r8188eu: remove needless check before usb_free_urb()

2013-09-23 Thread Wei Yongjun
From: Wei Yongjun 

usb_free_urb(NULL) is safe and this check is not required.

Signed-off-by: Wei Yongjun 
---
 drivers/staging/rtl8188eu/os_dep/recv_linux.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c 
b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
index e2f4e7d..1b670d8 100644
--- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
@@ -77,8 +77,7 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter,
 int rtw_os_recvbuf_resource_free(struct adapter *padapter,
 struct recv_buf *precvbuf)
 {
-   if (precvbuf->purb)
-   usb_free_urb(precvbuf->purb);
+   usb_free_urb(precvbuf->purb);
return _SUCCESS;
 }
 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel