[PATCH 0/2] staginng: atomisp: memory allocation cleanups

2017-10-08 Thread Aishwarya Pant
Patch series performs minor code cleanups using coccinelle to simplify memory
allocation tests and remove redundant OOM log messages.

Aishwarya Pant (2):
  staging: atomisp2: cleanup null check on memory allocation
  staging: atomisp: cleanup out of memory messages

 drivers/staging/media/atomisp/i2c/ap1302.c |  4 +--
 drivers/staging/media/atomisp/i2c/gc0310.c |  4 +--
 drivers/staging/media/atomisp/i2c/gc2235.c |  4 +--
 drivers/staging/media/atomisp/i2c/imx/imx.c|  4 +--
 drivers/staging/media/atomisp/i2c/lm3554.c |  4 +--
 drivers/staging/media/atomisp/i2c/mt9m114.c|  4 +--
 drivers/staging/media/atomisp/i2c/ov2680.c |  4 +--
 drivers/staging/media/atomisp/i2c/ov2722.c |  4 +--
 drivers/staging/media/atomisp/i2c/ov5693/ov5693.c  |  4 +--
 drivers/staging/media/atomisp/i2c/ov8858.c |  6 +---
 .../media/atomisp/pci/atomisp2/atomisp_fops.c  |  4 +--
 .../media/atomisp/pci/atomisp2/atomisp_ioctl.c |  9 ++
 .../media/atomisp/pci/atomisp2/css2400/sh_css.c| 36 +++---
 .../atomisp/pci/atomisp2/css2400/sh_css_firmware.c |  6 ++--
 .../pci/atomisp2/css2400/sh_css_param_shading.c|  4 +--
 .../media/atomisp/pci/atomisp2/hmm/hmm_bo.c| 10 ++
 .../atomisp/pci/atomisp2/hmm/hmm_dynamic_pool.c|  6 +---
 .../atomisp/pci/atomisp2/hmm/hmm_reserved_pool.c   |  5 +--
 .../media/atomisp/pci/atomisp2/hmm/hmm_vm.c|  4 +--
 .../platform/intel-mid/atomisp_gmin_platform.c |  4 +--
 20 files changed, 41 insertions(+), 89 deletions(-)

-- 
2.11.0

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


[PATCH 1/2] staging: atomisp2: cleanup null check on memory allocation

2017-10-08 Thread Aishwarya Pant
For memory allocation functions that fail with a NULL return value, it
is preferred to use the (!x) test in place of (x == NULL).

Changes in atomisp2/css2400/sh_css.c were done by hand.

Done with the help of the following cocci script:

@@
type T;
T* p;
statement s,s1;
@@

p =
  \(devm_kzalloc\|devm_ioremap\|usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\|
   
kmalloc\|kmalloc_array\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
   kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|devm_kzalloc\)(...)
...when != p

if (
- p == NULL
+ !p
 ) s
 else s1

Signed-off-by: Aishwarya Pant 

--
Changes in atomisp2/css2400/sh_css.c were done by hand, the above script
was not able to match the pattern if (a->b != null).
---
 .../media/atomisp/pci/atomisp2/css2400/sh_css.c| 36 +++---
 .../atomisp/pci/atomisp2/css2400/sh_css_firmware.c |  6 ++--
 .../pci/atomisp2/css2400/sh_css_param_shading.c|  2 +-
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
index e882b5596813..56de641d8848 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
@@ -5607,13 +5607,13 @@ static enum ia_css_err load_video_binaries(struct 
ia_css_pipe *pipe)
mycs->num_yuv_scaler = cas_scaler_descr.num_stage;
mycs->yuv_scaler_binary = kzalloc(cas_scaler_descr.num_stage *
sizeof(struct ia_css_binary), GFP_KERNEL);
-   if (mycs->yuv_scaler_binary == NULL) {
+   if (!mycs->yuv_scaler_binary) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
return err;
}
mycs->is_output_stage = kzalloc(cas_scaler_descr.num_stage
* sizeof(bool), GFP_KERNEL);
-   if (mycs->is_output_stage == NULL) {
+   if (!mycs->is_output_stage) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
return err;
}
@@ -6258,14 +6258,14 @@ static enum ia_css_err load_primary_binaries(
mycs->num_yuv_scaler = cas_scaler_descr.num_stage;
mycs->yuv_scaler_binary = kzalloc(cas_scaler_descr.num_stage *
sizeof(struct ia_css_binary), GFP_KERNEL);
-   if (mycs->yuv_scaler_binary == NULL) {
+   if (!mycs->yuv_scaler_binary) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
IA_CSS_LEAVE_ERR_PRIVATE(err);
return err;
}
mycs->is_output_stage = kzalloc(cas_scaler_descr.num_stage *
sizeof(bool), GFP_KERNEL);
-   if (mycs->is_output_stage == NULL) {
+   if (!mycs->is_output_stage) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
IA_CSS_LEAVE_ERR_PRIVATE(err);
return err;
@@ -6982,27 +6982,27 @@ static enum ia_css_err 
ia_css_pipe_create_cas_scaler_desc_single_output(
}
 
descr->in_info = kmalloc(descr->num_stage * sizeof(struct 
ia_css_frame_info), GFP_KERNEL);
-   if (descr->in_info == NULL) {
+   if (!descr->in_info) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
descr->internal_out_info = kmalloc(descr->num_stage * sizeof(struct 
ia_css_frame_info), GFP_KERNEL);
-   if (descr->internal_out_info == NULL) {
+   if (!descr->internal_out_info) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
descr->out_info = kmalloc(descr->num_stage * sizeof(struct 
ia_css_frame_info), GFP_KERNEL);
-   if (descr->out_info == NULL) {
+   if (!descr->out_info) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
descr->vf_info = kmalloc(descr->num_stage * sizeof(struct 
ia_css_frame_info), GFP_KERNEL);
-   if (descr->vf_info == NULL) {
+   if (!descr->vf_info) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
descr->is_output_stage = kmalloc(descr->num_stage * sizeof(bool), 
GFP_KERNEL);
-   if (descr->is_output_stage == NULL) {
+   if (!descr->is_output_stage) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
@@ -7118,22 +7118,22 @@ static enum ia_css_err 
ia_css_pipe_create_cas_scaler_desc(struct ia_css_pipe *pi
descr->num_stage = num_stages;
 
descr->in_info = kmalloc(descr->num_stage * sizeof(struct 
ia_css_frame_info), GFP_KERNEL);
-   if (descr->in_info == NULL) {
+   if (!descr->in_info) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
 

[PATCH 2/2] staging: atomisp: cleanup out of memory messages

2017-10-08 Thread Aishwarya Pant
Logging of explicit out of memory messages is redundant since memory allocation
failures produce a backtrace.

Done with the help of the following cocci script:

@@
expression ex, ret;
statement s;
constant char[] c;
constant err;
identifier f, l;
@@

ex =
\(kmalloc\|kmalloc_array\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|devm_kzalloc\)(...)
... when != ex

if (
(
!ex
|
unlikely(!ex)
)
)
- {
- f(..., c, ...);
(
return ret;
|
return;
|
return err;
|
goto l;
)
- }
else s

Another case where if branch has multiple statements was handled with the
following condition:

{
...
- f(..., c, ...);
...
}

Signed-off-by: Aishwarya Pant 
---
 drivers/staging/media/atomisp/i2c/ap1302.c |  4 +---
 drivers/staging/media/atomisp/i2c/gc0310.c |  4 +---
 drivers/staging/media/atomisp/i2c/gc2235.c |  4 +---
 drivers/staging/media/atomisp/i2c/imx/imx.c|  4 +---
 drivers/staging/media/atomisp/i2c/lm3554.c |  4 +---
 drivers/staging/media/atomisp/i2c/mt9m114.c|  4 +---
 drivers/staging/media/atomisp/i2c/ov2680.c |  4 +---
 drivers/staging/media/atomisp/i2c/ov2722.c |  4 +---
 drivers/staging/media/atomisp/i2c/ov5693/ov5693.c  |  4 +---
 drivers/staging/media/atomisp/i2c/ov8858.c |  6 +-
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c  |  4 +---
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c |  9 ++---
 .../media/atomisp/pci/atomisp2/css2400/sh_css_param_shading.c  |  4 +---
 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c| 10 ++
 .../staging/media/atomisp/pci/atomisp2/hmm/hmm_dynamic_pool.c  |  6 +-
 .../staging/media/atomisp/pci/atomisp2/hmm/hmm_reserved_pool.c |  5 +
 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_vm.c|  4 +---
 .../media/atomisp/platform/intel-mid/atomisp_gmin_platform.c   |  4 +---
 18 files changed, 20 insertions(+), 68 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/ap1302.c 
b/drivers/staging/media/atomisp/i2c/ap1302.c
index 2f772a020c8b..bfbf85122c3b 100644
--- a/drivers/staging/media/atomisp/i2c/ap1302.c
+++ b/drivers/staging/media/atomisp/i2c/ap1302.c
@@ -1153,10 +1153,8 @@ static int ap1302_probe(struct i2c_client *client,
 
/* allocate device & init sub device */
dev = devm_kzalloc(&client->dev, sizeof(*dev), GFP_KERNEL);
-   if (!dev) {
-   dev_err(&client->dev, "%s: out of memory\n", __func__);
+   if (!dev)
return -ENOMEM;
-   }
 
mutex_init(&dev->input_lock);
 
diff --git a/drivers/staging/media/atomisp/i2c/gc0310.c 
b/drivers/staging/media/atomisp/i2c/gc0310.c
index 35ed51ffe944..291565451bfe 100644
--- a/drivers/staging/media/atomisp/i2c/gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/gc0310.c
@@ -1385,10 +1385,8 @@ static int gc0310_probe(struct i2c_client *client,
 
pr_info("%s S\n", __func__);
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-   if (!dev) {
-   dev_err(&client->dev, "out of memory\n");
+   if (!dev)
return -ENOMEM;
-   }
 
mutex_init(&dev->input_lock);
 
diff --git a/drivers/staging/media/atomisp/i2c/gc2235.c 
b/drivers/staging/media/atomisp/i2c/gc2235.c
index e43d31ea9676..f51535eee091 100644
--- a/drivers/staging/media/atomisp/i2c/gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/gc2235.c
@@ -1123,10 +1123,8 @@ static int gc2235_probe(struct i2c_client *client,
unsigned int i;
 
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-   if (!dev) {
-   dev_err(&client->dev, "out of memory\n");
+   if (!dev)
return -ENOMEM;
-   }
 
mutex_init(&dev->input_lock);
 
diff --git a/drivers/staging/media/atomisp/i2c/imx/imx.c 
b/drivers/staging/media/atomisp/i2c/imx/imx.c
index 49ab0af87096..957fb1863b40 100644
--- a/drivers/staging/media/atomisp/i2c/imx/imx.c
+++ b/drivers/staging/media/atomisp/i2c/imx/imx.c
@@ -2365,10 +2365,8 @@ static int imx_probe(struct i2c_client *client,
 
/* allocate sensor device & init sub device */
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-   if (!dev) {
-   v4l2_err(client, "%s: out of memory\n", __func__);
+   if (!dev)
return -ENOMEM;
-   }
 
mutex_init(&dev->input_lock);
 
diff --git a/drivers/staging/media/atomisp/i2c/lm3554.c 
b/drivers/staging/media/atomisp/i2c/lm3554.c
index 679176f7c542..37876d245a02 100644
--- a/drivers/staging/media/atomisp/i2c/lm3554.c
+++ b/drivers/staging/media/atomisp/i2c/lm3554.c
@@ -871,10 +871,8 @@ static int lm3554_probe(struct i2c_client *client,
int ret;
 
flash = kzalloc(sizeof(*flash), GFP_KERNEL);
-   if (!flash) {
-   dev_err(&client->dev, "out of memory\n");
+   if (!flash)
return 

[PATCH v2 1/3] rtl8188eu: Fix a possible sleep-in-atomic bug in rtw_disassoc_cmd

2017-10-08 Thread Jia-Ju Bai
The driver may sleep under a spinlock, and the function call path is:
rtw_set_802_11_bssid(acquire the spinlock)
  rtw_disassoc_cmd
kzalloc(GFP_KERNEL) --> may sleep

To fix it, GFP_KERNEL is replaced with GFP_ATOMIC.
This bug is found by my static analysis tool and my code review.

Signed-off-by: Jia-Ju Bai 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 9461bce..65083a7 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -508,7 +508,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 
deauth_timeout_ms, bool enqueu
 
if (enqueue) {
/* need enqueue, prepare cmd_obj and enqueue */
-   cmdobj = kzalloc(sizeof(*cmdobj), GFP_KERNEL);
+   cmdobj = kzalloc(sizeof(*cmdobj), GFP_ATOMIC);
if (!cmdobj) {
res = _FAIL;
kfree(param);
-- 
1.7.9.5


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


[PATCH v2 2/3] rtl8188eu: Fix a possible sleep-in-atomic bug in rtw_createbss_cmd

2017-10-08 Thread Jia-Ju Bai
The driver may sleep under a spinlock, and the function call path is:
rtw_surveydone_event_callback(acquire the spinlock)
  rtw_createbss_cmd
kzalloc(GFP_KERNEL) --> may sleep

To fix it, GFP_KERNEL is replaced with GFP_ATOMIC.
This bug is found by my static analysis tool and my code review.

Signed-off-by: Jia-Ju Bai 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 9461bce..430b8eb 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -333,7 +333,7 @@ u8 rtw_createbss_cmd(struct adapter  *padapter)
else
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for 
SSid:%s\n", pmlmepriv->assoc_ssid.Ssid));
 
-   pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
+   pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
if (!pcmd) {
res = _FAIL;
goto exit;
-- 
1.7.9.5


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


[PATCH v2 3/3] rtl8188eu: Fix a possible sleep-in-atomic bug in _rtw_pwr_wakeup

2017-10-08 Thread Jia-Ju Bai
The driver may sleep under a spinlock, and the function call path is:
rtw_set_802_11_disassociate(acquire the spinlock)
  _rtw_pwr_wakeup
usleep_range --> may sleep

To fix it, usleep_range is replaced with udelay.
This bug is found by my static analysis tool and my code review.

Signed-off-by: Jia-Ju Bai 
---
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
index f86c9ce..2913661 100644
--- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
@@ -569,7 +569,7 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 
ips_deffer_ms, const char *cal
DBG_88E("%s wait ps_processing...\n", __func__);
while (pwrpriv->ps_processing &&
   jiffies_to_msecs(jiffies - start) <= 3000)
-   usleep_range(1000, 3000);
+   udelay(1500);
if (pwrpriv->ps_processing)
DBG_88E("%s wait ps_processing timeout\n", __func__);
else
-- 
1.7.9.5


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


[BUG] rtl8188eu: Some possible sleep-in-atomic bugs in ips_leave

2017-10-08 Thread Jia-Ju Bai

CC to mailing list.

On 2017/10/8 20:13, Jia-Ju Bai wrote:
The driver may sleep under a spinlock when calling the function 
"ips_leave", which causes some possible sleep-in-atomic bugs.

Here are several examples:
rtw_set_802_11_disassociate (acquire the spinlock)
  _rtw_pwr_wakeup
ips_leave
  mutex_lock --> may sleep

rtw_set_802_11_disassociate (acquire the spinlock)
  _rtw_pwr_wakeup
ips_leave
  rtw_ips_pwr_up
ips_netdrv_open
  rtw_hal_init
rtl8188eu_hal_init
  rtl88eu_download_fw
request_firmware --> may sleep
kmalloc --> may sleep

rtw_set_802_11_disassociate (acquire the spinlock)
  _rtw_pwr_wakeup
ips_leave
  rtw_set_key
kzalloc(GFP_KERNEL) --> may sleep

All these bugs are caused by that "ips_leave" calls some sleep-able 
functions.
A possible fix is to release the spinlock before calling "ips_leave", 
and acquire the spinlock again after it.


These bugs are found by my static analysis tool and my code review.


Thanks,
Jia-Ju Bai



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


Re: [PATCH v2 06/10] staging: rtl8723bs: Add space after ','

2017-10-08 Thread Harsha Sharma
On Wed, Sep 13, 2017 at 2:11 AM, Greg KH  wrote:
> On Tue, Sep 12, 2017 at 07:05:23PM +0530, Harsha Sharma wrote:
>> Space required after ','
>>
>> Signed-off-by: Harsha Sharma 
>> ---
>> Changes in v2:
>>  -Rebase against staging-testing and solve merge conflicts
>>
>>  drivers/staging/rtl8723bs/os_dep/os_intfs.c | 12 ++--
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> Where are the rest of the patches in this series, I only seem to have 2
> (patch 6 and patch 7 out of 10.)
>
> If you have to resend patches, please always do so as a unique series,
> If I have taken some of a previous series, please then send the new ones
> out as a totally unique series, as that is what they now are.
>
> Remember, make it totally obvious what I, as a maintainer, need to do
> here.  I have no memory of previous patch submissions, or what happened
> on something else somewhere else.  I deal with thousands of patches, and
> as such, have no short-term memory :)
>
Hi,
The other patches in this series have already been merged and only this one is
remaining, so should I still send whole patchset again or this patch can be
merged ?
Thanks for your time.

Regards,
Harsha Sharma

> thanks,
>
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 06/10] staging: rtl8723bs: Add space after ','

2017-10-08 Thread Harsha Sharma
Space is required after ',' according to linux-kernel coding style.

Signed-off-by: Harsha Sharma 
---
Other patches from this patchset have already been merged and only
this one is remaining.
Changes in v3:
 -Change log message and rebase against staging-testing
Changes in v2:
 -Rebase against staging-testing and solve merge conflicts

 drivers/staging/rtl8723bs/os_dep/os_intfs.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c 
b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index 51df42de9167..33e8098c34dd 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -45,7 +45,7 @@ static int rtw_soft_ap;
 static int rtw_power_mgnt = 1;
 static int rtw_ips_mode = IPS_NORMAL;
 module_param(rtw_ips_mode, int, 0644);
-MODULE_PARM_DESC(rtw_ips_mode,"The default IPS mode");
+MODULE_PARM_DESC(rtw_ips_mode, "The default IPS mode");
 
 static int rtw_smart_ps = 2;
 
@@ -185,7 +185,7 @@ module_param(rtw_hw_wps_pbc, int, 0644);
 
 static uint rtw_max_roaming_times = 2;
 module_param(rtw_max_roaming_times, uint, 0644);
-MODULE_PARM_DESC(rtw_max_roaming_times,"The max roaming times to try");
+MODULE_PARM_DESC(rtw_max_roaming_times, "The max roaming times to try");
 
 module_param(rtw_mc2u_disable, int, 0644);
 
@@ -206,10 +206,10 @@ static int rtw_tx_pwr_lmt_enable;
 static int rtw_tx_pwr_by_rate;
 
 module_param(rtw_tx_pwr_lmt_enable, int, 0644);
-MODULE_PARM_DESC(rtw_tx_pwr_lmt_enable,"0:Disable, 1:Enable, 2: Depend on 
efuse");
+MODULE_PARM_DESC(rtw_tx_pwr_lmt_enable, "0:Disable, 1:Enable, 2: Depend on 
efuse");
 
 module_param(rtw_tx_pwr_by_rate, int, 0644);
-MODULE_PARM_DESC(rtw_tx_pwr_by_rate,"0:Disable, 1:Enable, 2: Depend on efuse");
+MODULE_PARM_DESC(rtw_tx_pwr_by_rate, "0:Disable, 1:Enable, 2: Depend on 
efuse");
 
 char *rtw_phy_file_path = "";
 module_param(rtw_phy_file_path, charp, 0644);
@@ -224,10 +224,10 @@ MODULE_PARM_DESC(rtw_phy_file_path, "The path of phy 
parameter");
 /*  BIT6 - RF_TXPWR_LMT,   0: non-support, 1: support */
 static int rtw_load_phy_file = (BIT2 | BIT6);
 module_param(rtw_load_phy_file, int, 0644);
-MODULE_PARM_DESC(rtw_load_phy_file,"PHY File Bit Map");
+MODULE_PARM_DESC(rtw_load_phy_file, "PHY File Bit Map");
 static int rtw_decrypt_phy_file;
 module_param(rtw_decrypt_phy_file, int, 0644);
-MODULE_PARM_DESC(rtw_decrypt_phy_file,"Enable Decrypt PHY File");
+MODULE_PARM_DESC(rtw_decrypt_phy_file, "Enable Decrypt PHY File");
 
 int _netdev_open(struct net_device *pnetdev);
 int netdev_open (struct net_device *pnetdev);
-- 
2.11.0

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


[BUG] vt6655: A possible sleep-in-atomic bug in vt6655_suspend

2017-10-08 Thread Jia-Ju Bai

According to device_main.c, the driver may sleep under a spinlock,
and the function call path is:
vt6655_suspend (acquire the spinlock)
  pci_set_power_state
__pci_start_power_transition (drivers/pci/pci.c)
  msleep --> may sleep

A possible fix is to replace msleep with mdelay in 
__pci_start_power_transition in drivers/pci/pci.c.


This bug is found by my static analysis tool and my code review.


Thanks,
Jia-Ju Bai

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


Re: [BUG] vt6655: A possible sleep-in-atomic bug in vt6655_suspend

2017-10-08 Thread Greg KH
On Mon, Oct 09, 2017 at 09:10:28AM +0800, Jia-Ju Bai wrote:
> According to device_main.c, the driver may sleep under a spinlock,
> and the function call path is:
> vt6655_suspend (acquire the spinlock)
>   pci_set_power_state
> __pci_start_power_transition (drivers/pci/pci.c)
>   msleep --> may sleep
> 
> A possible fix is to replace msleep with mdelay in
> __pci_start_power_transition in drivers/pci/pci.c.

Patches are usually best to send in for things that you find like this.

thanks,

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