All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Issue suggested by Coccinelle using ret.cocci
@ 2019-03-17 21:33 Madhumitha Prabakaran
  2019-03-17 21:33 ` [PATCH v2 1/5] Staging: rtl8723bs: Remove wrapper functions and change function names Madhumitha Prabakaran
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Madhumitha Prabakaran @ 2019-03-17 21:33 UTC (permalink / raw)
  To: gregkh, outreachy-kernel; +Cc: Madhumitha Prabakaran

This patchset does tasks as below:
1) Drop wrapper functions and change function names
2) Change type of variables and return type
3) Change values to standard error codes in functions
4) Replace NULL comparison with !
5) Add missing NULL check for kmalloc

All these patches are relevant to an issue suggested by Coccinelle using
ret.cocci.

Madhumitha Prabakaran (5):
  Staging: rtl8723bs: Remove wrapper functions and change function names
  Staging: rtl8723bs: Change type of variables and return type
  Staging: rtl8723bs:  Change values to standard error codes in
    functions
  Staging: rtl8723bs: Replace NULL comparison with !
  Staging: rtl8723bs: Add missing NULL check for kmalloc

---
Changes in v2 -

1) Modified commit log here
2) Dropped patch 4,5,6
3) Included patch 4 for replace NULL comparison with !
4) Merged patch 4 in patch 1, which is to remove unwanted function
declarations.
5) Merged patch 5 with patch 3, which is to replace error codes in
functions.
6) Merged patch 6 with patch 1, which is to remove extern and change
return type
7) Removed unnecessary local variable res in function rtw_init_evt_priv

 drivers/staging/rtl8723bs/core/rtw_cmd.c      | 37 ++++++-------------
 drivers/staging/rtl8723bs/include/cmd_osdep.h |  4 +-
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  2 -
 drivers/staging/rtl8723bs/os_dep/os_intfs.c   |  4 +-
 4 files changed, 15 insertions(+), 32 deletions(-)

-- 
2.17.1



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/5] Staging: rtl8723bs: Remove wrapper functions and change function names
  2019-03-17 21:33 [PATCH v2 0/5] Issue suggested by Coccinelle using ret.cocci Madhumitha Prabakaran
@ 2019-03-17 21:33 ` Madhumitha Prabakaran
  2019-03-17 21:33 ` [PATCH v2 2/5] Staging: rtl8723bs: Change type of variables and return type Madhumitha Prabakaran
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Madhumitha Prabakaran @ 2019-03-17 21:33 UTC (permalink / raw)
  To: gregkh, outreachy-kernel; +Cc: Madhumitha Prabakaran

Drop wrappers rtw_init_cmd_priv and rtw_init_evt_priv and remove their
function declarations, as their only purpose is to call other functions.
Change function names from _rtw_init_cmd_priv to
rtw_init_cmd_priv, and _rtw_init_evt_priv to rtw_init_evt_priv in
function definitions and function declarations. Also, remove externs in
function declarations rtw_init_cmd_priv and rtw_init_evt_priv, to
maintain Linux kernel coding style.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c      | 20 ++-----------------
 drivers/staging/rtl8723bs/include/cmd_osdep.h |  4 ++--
 drivers/staging/rtl8723bs/include/rtw_cmd.h   |  2 --
 3 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 91520ca3bbad..793bc505fa9c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -162,7 +162,7 @@ Caller and the rtw_cmd_thread can protect cmd_q by spin_lock.
 No irqsave is necessary.
 */
 
-sint	_rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
+sint rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
 {
 	sint res = _SUCCESS;
 
@@ -201,7 +201,7 @@ sint	_rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
 }
 
 static void c2h_wk_callback(_workitem *work);
-sint _rtw_init_evt_priv(struct evt_priv *pevtpriv)
+sint rtw_init_evt_priv(struct evt_priv *pevtpriv)
 {
 	sint res = _SUCCESS;
 
@@ -295,22 +295,6 @@ struct	cmd_obj	*_rtw_dequeue_cmd(struct __queue *queue)
 	return obj;
 }
 
-u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
-{
-	u32 res;
-
-	res = _rtw_init_cmd_priv(pcmdpriv);
-	return res;
-}
-
-u32 rtw_init_evt_priv(struct	evt_priv *pevtpriv)
-{
-	int	res;
-
-	res = _rtw_init_evt_priv(pevtpriv);
-	return res;
-}
-
 void rtw_free_evt_priv(struct	evt_priv *pevtpriv)
 {
 	RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("rtw_free_evt_priv\n"));
diff --git a/drivers/staging/rtl8723bs/include/cmd_osdep.h b/drivers/staging/rtl8723bs/include/cmd_osdep.h
index 0749936df032..8ed913726d5a 100644
--- a/drivers/staging/rtl8723bs/include/cmd_osdep.h
+++ b/drivers/staging/rtl8723bs/include/cmd_osdep.h
@@ -8,8 +8,8 @@
 #define __CMD_OSDEP_H_
 
 
-extern sint _rtw_init_cmd_priv (struct	cmd_priv *pcmdpriv);
-extern sint _rtw_init_evt_priv(struct evt_priv *pevtpriv);
+sint rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv);
+sint rtw_init_evt_priv(struct evt_priv *pevtpriv);
 extern void _rtw_free_evt_priv (struct	evt_priv *pevtpriv);
 extern void _rtw_free_cmd_priv (struct	cmd_priv *pcmdpriv);
 extern sint _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj);
diff --git a/drivers/staging/rtl8723bs/include/rtw_cmd.h b/drivers/staging/rtl8723bs/include/rtw_cmd.h
index 299b55538788..fa4ebc3d7539 100644
--- a/drivers/staging/rtl8723bs/include/rtw_cmd.h
+++ b/drivers/staging/rtl8723bs/include/rtw_cmd.h
@@ -129,10 +129,8 @@ extern void rtw_free_cmd_obj(struct cmd_obj *pcmd);
 void rtw_stop_cmd_thread(struct adapter *adapter);
 int rtw_cmd_thread(void *context);
 
-extern u32 rtw_init_cmd_priv (struct cmd_priv *pcmdpriv);
 extern void rtw_free_cmd_priv (struct cmd_priv *pcmdpriv);
 
-extern u32 rtw_init_evt_priv (struct evt_priv *pevtpriv);
 extern void rtw_free_evt_priv (struct evt_priv *pevtpriv);
 extern void rtw_evt_notify_isr(struct evt_priv *pevtpriv);
 
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 2/5] Staging: rtl8723bs: Change type of variables and return type
  2019-03-17 21:33 [PATCH v2 0/5] Issue suggested by Coccinelle using ret.cocci Madhumitha Prabakaran
  2019-03-17 21:33 ` [PATCH v2 1/5] Staging: rtl8723bs: Remove wrapper functions and change function names Madhumitha Prabakaran
@ 2019-03-17 21:33 ` Madhumitha Prabakaran
  2019-03-17 21:52   ` [Outreachy kernel] " Julia Lawall
  2019-03-17 21:33 ` [PATCH v2 3/5] Staging: rtl8723bs: Change values to standard error codes in functions Madhumitha Prabakaran
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Madhumitha Prabakaran @ 2019-03-17 21:33 UTC (permalink / raw)
  To: gregkh, outreachy-kernel; +Cc: Madhumitha Prabakaran

Change type of local variables 'res' and return type of functions
'rtw_init_cmd_pri' and 'rtw_init_evt_priv', as function's
return types are defined for standard error codes _SUCCESS and _FAIL.
Also, change return type of functions declarations corresponding to
change made in function definitions.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c      | 8 ++++----
 drivers/staging/rtl8723bs/include/cmd_osdep.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 793bc505fa9c..ab450f717f34 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -162,9 +162,9 @@ Caller and the rtw_cmd_thread can protect cmd_q by spin_lock.
 No irqsave is necessary.
 */
 
-sint rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
+int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
 {
-	sint res = _SUCCESS;
+	int res = _SUCCESS;
 
 	init_completion(&pcmdpriv->cmd_queue_comp);
 	init_completion(&pcmdpriv->terminate_cmdthread_comp);
@@ -201,9 +201,9 @@ sint rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
 }
 
 static void c2h_wk_callback(_workitem *work);
-sint rtw_init_evt_priv(struct evt_priv *pevtpriv)
+int rtw_init_evt_priv(struct evt_priv *pevtpriv)
 {
-	sint res = _SUCCESS;
+	int res = _SUCCESS;
 
 	/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
 	atomic_set(&pevtpriv->event_seq, 0);
diff --git a/drivers/staging/rtl8723bs/include/cmd_osdep.h b/drivers/staging/rtl8723bs/include/cmd_osdep.h
index 8ed913726d5a..06ab48263757 100644
--- a/drivers/staging/rtl8723bs/include/cmd_osdep.h
+++ b/drivers/staging/rtl8723bs/include/cmd_osdep.h
@@ -8,8 +8,8 @@
 #define __CMD_OSDEP_H_
 
 
-sint rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv);
-sint rtw_init_evt_priv(struct evt_priv *pevtpriv);
+int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv);
+int rtw_init_evt_priv(struct evt_priv *pevtpriv);
 extern void _rtw_free_evt_priv (struct	evt_priv *pevtpriv);
 extern void _rtw_free_cmd_priv (struct	cmd_priv *pcmdpriv);
 extern sint _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj);
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 3/5] Staging: rtl8723bs:  Change values to standard error codes in functions
  2019-03-17 21:33 [PATCH v2 0/5] Issue suggested by Coccinelle using ret.cocci Madhumitha Prabakaran
  2019-03-17 21:33 ` [PATCH v2 1/5] Staging: rtl8723bs: Remove wrapper functions and change function names Madhumitha Prabakaran
  2019-03-17 21:33 ` [PATCH v2 2/5] Staging: rtl8723bs: Change type of variables and return type Madhumitha Prabakaran
@ 2019-03-17 21:33 ` Madhumitha Prabakaran
       [not found]   ` <alpine.DEB.2.21.1903172253010.2434@hadrien>
  2019-03-18  6:42   ` Greg KH
  2019-03-17 21:33 ` [PATCH v2 4/5] Staging: rtl8723bs: Replace NULL comparison with ! Madhumitha Prabakaran
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 16+ messages in thread
From: Madhumitha Prabakaran @ 2019-03-17 21:33 UTC (permalink / raw)
  To: gregkh, outreachy-kernel; +Cc: Madhumitha Prabakaran

Change values to stand error codes in functions rtw_init_cmd_priv and
rtw_init_evt_priv, as _SUCCESS should be 0 and _FAIL should be -ENOMEM
(as in this case, these are memory allocating functions). Also, change
the values in corresponding call sites of the functions.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c    | 8 ++++----
 drivers/staging/rtl8723bs/os_dep/os_intfs.c | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index ab450f717f34..f8a4f910bfea 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -164,7 +164,7 @@ No irqsave is necessary.
 
 int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
 {
-	int res = _SUCCESS;
+	int res = 0;
 
 	init_completion(&pcmdpriv->cmd_queue_comp);
 	init_completion(&pcmdpriv->terminate_cmdthread_comp);
@@ -178,7 +178,7 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
 	pcmdpriv->cmd_allocated_buf = rtw_zmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ);
 
 	if (pcmdpriv->cmd_allocated_buf == NULL) {
-		res = _FAIL;
+		res = -ENOMEM;
 		goto exit;
 	}
 
@@ -187,7 +187,7 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
 	pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4);
 
 	if (pcmdpriv->rsp_allocated_buf == NULL) {
-		res = _FAIL;
+		res = -ENOMEM;
 		goto exit;
 	}
 
@@ -203,7 +203,7 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
 static void c2h_wk_callback(_workitem *work);
 int rtw_init_evt_priv(struct evt_priv *pevtpriv)
 {
-	int res = _SUCCESS;
+	int res = 0;
 
 	/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
 	atomic_set(&pevtpriv->event_seq, 0);
diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index 143e3f9b31aa..6b3def0397f0 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -757,7 +757,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
 
 	rtw_init_hal_com_default_value(padapter);
 
-	if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == _FAIL) {
+	if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == -ENOMEM) {
 		RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init cmd_priv\n"));
 		ret8 = _FAIL;
 		goto exit;
@@ -765,7 +765,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
 
 	padapter->cmdpriv.padapter = padapter;
 
-	if ((rtw_init_evt_priv(&padapter->evtpriv)) == _FAIL) {
+	if ((rtw_init_evt_priv(&padapter->evtpriv)) == -ENOMEM) {
 		RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init evt_priv\n"));
 		ret8 = _FAIL;
 		goto exit;
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 4/5] Staging: rtl8723bs: Replace NULL comparison with !
  2019-03-17 21:33 [PATCH v2 0/5] Issue suggested by Coccinelle using ret.cocci Madhumitha Prabakaran
                   ` (2 preceding siblings ...)
  2019-03-17 21:33 ` [PATCH v2 3/5] Staging: rtl8723bs: Change values to standard error codes in functions Madhumitha Prabakaran
@ 2019-03-17 21:33 ` Madhumitha Prabakaran
  2019-03-17 21:33 ` [PATCH v2 5/5] Staging: rtl8723bs: Add missing NULL check for kmalloc Madhumitha Prabakaran
  2019-03-18  6:46 ` [PATCH v2 0/5] Issue suggested by Coccinelle using ret.cocci Greg KH
  5 siblings, 0 replies; 16+ messages in thread
From: Madhumitha Prabakaran @ 2019-03-17 21:33 UTC (permalink / raw)
  To: gregkh, outreachy-kernel; +Cc: Madhumitha Prabakaran

Replace NULL comparison with ! in function rtw_init_cmd_priv, to
maintain Linux kernel coding style.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index f8a4f910bfea..3550de9f12c3 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -177,7 +177,7 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
 
 	pcmdpriv->cmd_allocated_buf = rtw_zmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ);
 
-	if (pcmdpriv->cmd_allocated_buf == NULL) {
+	if (!pcmdpriv->cmd_allocated_buf) {
 		res = -ENOMEM;
 		goto exit;
 	}
@@ -186,7 +186,7 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
 
 	pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4);
 
-	if (pcmdpriv->rsp_allocated_buf == NULL) {
+	if (!pcmdpriv->rsp_allocated_buf) {
 		res = -ENOMEM;
 		goto exit;
 	}
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 5/5] Staging: rtl8723bs: Add missing NULL check for kmalloc
  2019-03-17 21:33 [PATCH v2 0/5] Issue suggested by Coccinelle using ret.cocci Madhumitha Prabakaran
                   ` (3 preceding siblings ...)
  2019-03-17 21:33 ` [PATCH v2 4/5] Staging: rtl8723bs: Replace NULL comparison with ! Madhumitha Prabakaran
@ 2019-03-17 21:33 ` Madhumitha Prabakaran
  2019-03-17 21:55   ` [Outreachy kernel] " Julia Lawall
  2019-03-18  6:46 ` [PATCH v2 0/5] Issue suggested by Coccinelle using ret.cocci Greg KH
  5 siblings, 1 reply; 16+ messages in thread
From: Madhumitha Prabakaran @ 2019-03-17 21:33 UTC (permalink / raw)
  To: gregkh, outreachy-kernel; +Cc: Madhumitha Prabakaran

Include missing NULL check for kmalloc in function rtw_init_evt_priv.
Also, remove unnecessary local variable 'res' in the function and
replace the value directly in the return of the function.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 3550de9f12c3..c76f27a6b3ab 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -203,8 +203,6 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
 static void c2h_wk_callback(_workitem *work);
 int rtw_init_evt_priv(struct evt_priv *pevtpriv)
 {
-	int res = 0;
-
 	/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
 	atomic_set(&pevtpriv->event_seq, 0);
 	pevtpriv->evt_done_cnt = 0;
@@ -213,7 +211,10 @@ int rtw_init_evt_priv(struct evt_priv *pevtpriv)
 	pevtpriv->c2h_wk_alive = false;
 	pevtpriv->c2h_queue = rtw_cbuf_alloc(C2H_QUEUE_MAX_LEN+1);
 
-	return res;
+	if (!pevtpriv->c2h_queue)
+		return -ENOMEM;
+
+	return 0;
 }
 
 void _rtw_free_evt_priv(struct	evt_priv *pevtpriv)
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [Outreachy kernel] [PATCH v2 2/5] Staging: rtl8723bs: Change type of variables and return type
  2019-03-17 21:33 ` [PATCH v2 2/5] Staging: rtl8723bs: Change type of variables and return type Madhumitha Prabakaran
@ 2019-03-17 21:52   ` Julia Lawall
  2019-03-17 23:34     ` Madhumthia Prabakaran
  0 siblings, 1 reply; 16+ messages in thread
From: Julia Lawall @ 2019-03-17 21:52 UTC (permalink / raw)
  To: Madhumitha Prabakaran; +Cc: gregkh, outreachy-kernel



On Sun, 17 Mar 2019, Madhumitha Prabakaran wrote:

> Change type of local variables 'res' and return type of functions
> 'rtw_init_cmd_pri' and 'rtw_init_evt_priv', as function's
> return types are defined for standard error codes _SUCCESS and _FAIL.

I'm not sure to undestand the reference to _SUCCESS and _FAIL.  sint is a
typedef for signed int, but kernel code typically uses just int rather
than signed int.  In any case, the change doesn't have any impact on the
types in the code.

julia

> Also, change return type of functions declarations corresponding to
> change made in function definitions.
>
> Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_cmd.c      | 8 ++++----
>  drivers/staging/rtl8723bs/include/cmd_osdep.h | 4 ++--
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> index 793bc505fa9c..ab450f717f34 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> @@ -162,9 +162,9 @@ Caller and the rtw_cmd_thread can protect cmd_q by spin_lock.
>  No irqsave is necessary.
>  */
>
> -sint rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
> +int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
>  {
> -	sint res = _SUCCESS;
> +	int res = _SUCCESS;
>
>  	init_completion(&pcmdpriv->cmd_queue_comp);
>  	init_completion(&pcmdpriv->terminate_cmdthread_comp);
> @@ -201,9 +201,9 @@ sint rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
>  }
>
>  static void c2h_wk_callback(_workitem *work);
> -sint rtw_init_evt_priv(struct evt_priv *pevtpriv)
> +int rtw_init_evt_priv(struct evt_priv *pevtpriv)
>  {
> -	sint res = _SUCCESS;
> +	int res = _SUCCESS;
>
>  	/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
>  	atomic_set(&pevtpriv->event_seq, 0);
> diff --git a/drivers/staging/rtl8723bs/include/cmd_osdep.h b/drivers/staging/rtl8723bs/include/cmd_osdep.h
> index 8ed913726d5a..06ab48263757 100644
> --- a/drivers/staging/rtl8723bs/include/cmd_osdep.h
> +++ b/drivers/staging/rtl8723bs/include/cmd_osdep.h
> @@ -8,8 +8,8 @@
>  #define __CMD_OSDEP_H_
>
>
> -sint rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv);
> -sint rtw_init_evt_priv(struct evt_priv *pevtpriv);
> +int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv);
> +int rtw_init_evt_priv(struct evt_priv *pevtpriv);
>  extern void _rtw_free_evt_priv (struct	evt_priv *pevtpriv);
>  extern void _rtw_free_cmd_priv (struct	cmd_priv *pcmdpriv);
>  extern sint _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj);
> --
> 2.17.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/cce081516153acd64194786cb1373150172d73cf.1552858206.git.madhumithabiw%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Outreachy kernel] [PATCH v2 5/5] Staging: rtl8723bs: Add missing NULL check for kmalloc
  2019-03-17 21:33 ` [PATCH v2 5/5] Staging: rtl8723bs: Add missing NULL check for kmalloc Madhumitha Prabakaran
@ 2019-03-17 21:55   ` Julia Lawall
  2019-03-17 23:42     ` Madhumthia Prabakaran
  0 siblings, 1 reply; 16+ messages in thread
From: Julia Lawall @ 2019-03-17 21:55 UTC (permalink / raw)
  To: Madhumitha Prabakaran; +Cc: gregkh, outreachy-kernel



On Sun, 17 Mar 2019, Madhumitha Prabakaran wrote:

> Include missing NULL check for kmalloc in function rtw_init_evt_priv.
> Also, remove unnecessary local variable 'res' in the function and
> replace the value directly in the return of the function.

These changes seem quite unrelated.  Dropping res was possible before any
of the other changes because its value was never updated, and if you make
your change, the value of res is not updated either.

julia

>
> Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_cmd.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> index 3550de9f12c3..c76f27a6b3ab 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> @@ -203,8 +203,6 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
>  static void c2h_wk_callback(_workitem *work);
>  int rtw_init_evt_priv(struct evt_priv *pevtpriv)
>  {
> -	int res = 0;
> -
>  	/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
>  	atomic_set(&pevtpriv->event_seq, 0);
>  	pevtpriv->evt_done_cnt = 0;
> @@ -213,7 +211,10 @@ int rtw_init_evt_priv(struct evt_priv *pevtpriv)
>  	pevtpriv->c2h_wk_alive = false;
>  	pevtpriv->c2h_queue = rtw_cbuf_alloc(C2H_QUEUE_MAX_LEN+1);
>
> -	return res;
> +	if (!pevtpriv->c2h_queue)
> +		return -ENOMEM;
> +
> +	return 0;
>  }
>
>  void _rtw_free_evt_priv(struct	evt_priv *pevtpriv)
> --
> 2.17.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/4010080c4d3e2bd0ed50a747eff3d00c66eea169.1552858206.git.madhumithabiw%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Outreachy kernel] [PATCH v2 2/5] Staging: rtl8723bs: Change type of variables and return type
  2019-03-17 21:52   ` [Outreachy kernel] " Julia Lawall
@ 2019-03-17 23:34     ` Madhumthia Prabakaran
  2019-03-18  7:30       ` Julia Lawall
  0 siblings, 1 reply; 16+ messages in thread
From: Madhumthia Prabakaran @ 2019-03-17 23:34 UTC (permalink / raw)
  To: Julia Lawall, outreachy-kernel

On Sun, Mar 17, 2019 at 10:52:35PM +0100, Julia Lawall wrote:
> 
> 
> On Sun, 17 Mar 2019, Madhumitha Prabakaran wrote:
> 
> > Change type of local variables 'res' and return type of functions
> > 'rtw_init_cmd_pri' and 'rtw_init_evt_priv', as function's
> > return types are defined for standard error codes _SUCCESS and _FAIL.
> 
> I'm not sure to undestand the reference to _SUCCESS and _FAIL.  sint is a
> typedef for signed int, but kernel code typically uses just int rather
> than signed int.  In any case, the change doesn't have any impact on the
> types in the code.

That's true. Should I drop this patch?

thanks

> 
> julia
> 
> > Also, change return type of functions declarations corresponding to
> > change made in function definitions.
> >
> > Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> > ---
> >  drivers/staging/rtl8723bs/core/rtw_cmd.c      | 8 ++++----
> >  drivers/staging/rtl8723bs/include/cmd_osdep.h | 4 ++--
> >  2 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > index 793bc505fa9c..ab450f717f34 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > @@ -162,9 +162,9 @@ Caller and the rtw_cmd_thread can protect cmd_q by spin_lock.
> >  No irqsave is necessary.
> >  */
> >
> > -sint rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
> > +int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
> >  {
> > -	sint res = _SUCCESS;
> > +	int res = _SUCCESS;
> >
> >  	init_completion(&pcmdpriv->cmd_queue_comp);
> >  	init_completion(&pcmdpriv->terminate_cmdthread_comp);
> > @@ -201,9 +201,9 @@ sint rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
> >  }
> >
> >  static void c2h_wk_callback(_workitem *work);
> > -sint rtw_init_evt_priv(struct evt_priv *pevtpriv)
> > +int rtw_init_evt_priv(struct evt_priv *pevtpriv)
> >  {
> > -	sint res = _SUCCESS;
> > +	int res = _SUCCESS;
> >
> >  	/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
> >  	atomic_set(&pevtpriv->event_seq, 0);
> > diff --git a/drivers/staging/rtl8723bs/include/cmd_osdep.h b/drivers/staging/rtl8723bs/include/cmd_osdep.h
> > index 8ed913726d5a..06ab48263757 100644
> > --- a/drivers/staging/rtl8723bs/include/cmd_osdep.h
> > +++ b/drivers/staging/rtl8723bs/include/cmd_osdep.h
> > @@ -8,8 +8,8 @@
> >  #define __CMD_OSDEP_H_
> >
> >
> > -sint rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv);
> > -sint rtw_init_evt_priv(struct evt_priv *pevtpriv);
> > +int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv);
> > +int rtw_init_evt_priv(struct evt_priv *pevtpriv);
> >  extern void _rtw_free_evt_priv (struct	evt_priv *pevtpriv);
> >  extern void _rtw_free_cmd_priv (struct	cmd_priv *pcmdpriv);
> >  extern sint _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj);
> > --
> > 2.17.1
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/cce081516153acd64194786cb1373150172d73cf.1552858206.git.madhumithabiw%40gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903172250420.2434%40hadrien.
> For more options, visit https://groups.google.com/d/optout.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Outreachy kernel] [PATCH v2 3/5] Staging: rtl8723bs: Change values to standard error codes in functions
       [not found]   ` <alpine.DEB.2.21.1903172253010.2434@hadrien>
@ 2019-03-17 23:37     ` Madhumthia Prabakaran
  2019-03-18  7:27       ` Julia Lawall
  0 siblings, 1 reply; 16+ messages in thread
From: Madhumthia Prabakaran @ 2019-03-17 23:37 UTC (permalink / raw)
  To: Julia Lawall, outreachy-kernel

On Sun, Mar 17, 2019 at 10:53:28PM +0100, Julia Lawall wrote:
> 
> 
> On Sun, 17 Mar 2019, Madhumitha Prabakaran wrote:
> 
> > Change values to stand error codes in functions rtw_init_cmd_priv and
> > rtw_init_evt_priv, as _SUCCESS should be 0 and _FAIL should be -ENOMEM
> > (as in this case, these are memory allocating functions).
> 
> You don't have to change it, but the above is a really long sentence.
> 
> julia

I will fix this commit log, as I made a mistake in mentioning "stand
error code". 

> 
> > Also, change
> > the values in corresponding call sites of the functions.
> >
> > Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> > ---
> >  drivers/staging/rtl8723bs/core/rtw_cmd.c    | 8 ++++----
> >  drivers/staging/rtl8723bs/os_dep/os_intfs.c | 4 ++--
> >  2 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > index ab450f717f34..f8a4f910bfea 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > @@ -164,7 +164,7 @@ No irqsave is necessary.
> >
> >  int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
> >  {
> > -	int res = _SUCCESS;
> > +	int res = 0;
> >
> >  	init_completion(&pcmdpriv->cmd_queue_comp);
> >  	init_completion(&pcmdpriv->terminate_cmdthread_comp);
> > @@ -178,7 +178,7 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
> >  	pcmdpriv->cmd_allocated_buf = rtw_zmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ);
> >
> >  	if (pcmdpriv->cmd_allocated_buf == NULL) {
> > -		res = _FAIL;
> > +		res = -ENOMEM;
> >  		goto exit;
> >  	}
> >
> > @@ -187,7 +187,7 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
> >  	pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4);
> >
> >  	if (pcmdpriv->rsp_allocated_buf == NULL) {
> > -		res = _FAIL;
> > +		res = -ENOMEM;
> >  		goto exit;
> >  	}
> >
> > @@ -203,7 +203,7 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
> >  static void c2h_wk_callback(_workitem *work);
> >  int rtw_init_evt_priv(struct evt_priv *pevtpriv)
> >  {
> > -	int res = _SUCCESS;
> > +	int res = 0;
> >
> >  	/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
> >  	atomic_set(&pevtpriv->event_seq, 0);
> > diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> > index 143e3f9b31aa..6b3def0397f0 100644
> > --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> > +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> > @@ -757,7 +757,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
> >
> >  	rtw_init_hal_com_default_value(padapter);
> >
> > -	if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == _FAIL) {
> > +	if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == -ENOMEM) {
> >  		RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init cmd_priv\n"));
> >  		ret8 = _FAIL;
> >  		goto exit;
> > @@ -765,7 +765,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
> >
> >  	padapter->cmdpriv.padapter = padapter;
> >
> > -	if ((rtw_init_evt_priv(&padapter->evtpriv)) == _FAIL) {
> > +	if ((rtw_init_evt_priv(&padapter->evtpriv)) == -ENOMEM) {
> >  		RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init evt_priv\n"));
> >  		ret8 = _FAIL;
> >  		goto exit;
> > --
> > 2.17.1
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/3079e4485a34348cdaed25939551424267ee32f6.1552858206.git.madhumithabiw%40gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Outreachy kernel] [PATCH v2 5/5] Staging: rtl8723bs: Add missing NULL check for kmalloc
  2019-03-17 21:55   ` [Outreachy kernel] " Julia Lawall
@ 2019-03-17 23:42     ` Madhumthia Prabakaran
  2019-03-18  7:29       ` Julia Lawall
  0 siblings, 1 reply; 16+ messages in thread
From: Madhumthia Prabakaran @ 2019-03-17 23:42 UTC (permalink / raw)
  To: Julia Lawall, outreachy-kernel

On Sun, Mar 17, 2019 at 10:55:05PM +0100, Julia Lawall wrote:
> 
> 
> On Sun, 17 Mar 2019, Madhumitha Prabakaran wrote:
> 
> > Include missing NULL check for kmalloc in function rtw_init_evt_priv.
> > Also, remove unnecessary local variable 'res' in the function and
> > replace the value directly in the return of the function.
> 
> These changes seem quite unrelated.  Dropping res was possible before any
> of the other changes because its value was never updated, and if you make
> your change, the value of res is not updated either.

Yeah! But it is in same function, also res is not used anywhere in the
function. So I removed it and changed the return type as return 0.

> 
> julia
> 
> >
> > Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> > ---
> >  drivers/staging/rtl8723bs/core/rtw_cmd.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > index 3550de9f12c3..c76f27a6b3ab 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > @@ -203,8 +203,6 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
> >  static void c2h_wk_callback(_workitem *work);
> >  int rtw_init_evt_priv(struct evt_priv *pevtpriv)
> >  {
> > -	int res = 0;
> > -
> >  	/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
> >  	atomic_set(&pevtpriv->event_seq, 0);
> >  	pevtpriv->evt_done_cnt = 0;
> > @@ -213,7 +211,10 @@ int rtw_init_evt_priv(struct evt_priv *pevtpriv)
> >  	pevtpriv->c2h_wk_alive = false;
> >  	pevtpriv->c2h_queue = rtw_cbuf_alloc(C2H_QUEUE_MAX_LEN+1);
> >
> > -	return res;
> > +	if (!pevtpriv->c2h_queue)
> > +		return -ENOMEM;
> > +
> > +	return 0;
> >  }
> >
> >  void _rtw_free_evt_priv(struct	evt_priv *pevtpriv)
> > --
> > 2.17.1
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/4010080c4d3e2bd0ed50a747eff3d00c66eea169.1552858206.git.madhumithabiw%40gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903172254090.2434%40hadrien.
> For more options, visit https://groups.google.com/d/optout.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 3/5] Staging: rtl8723bs:  Change values to standard error codes in functions
  2019-03-17 21:33 ` [PATCH v2 3/5] Staging: rtl8723bs: Change values to standard error codes in functions Madhumitha Prabakaran
       [not found]   ` <alpine.DEB.2.21.1903172253010.2434@hadrien>
@ 2019-03-18  6:42   ` Greg KH
  1 sibling, 0 replies; 16+ messages in thread
From: Greg KH @ 2019-03-18  6:42 UTC (permalink / raw)
  To: Madhumitha Prabakaran; +Cc: outreachy-kernel

On Sun, Mar 17, 2019 at 04:33:56PM -0500, Madhumitha Prabakaran wrote:
> Change values to stand error codes in functions rtw_init_cmd_priv and
> rtw_init_evt_priv, as _SUCCESS should be 0 and _FAIL should be -ENOMEM
> (as in this case, these are memory allocating functions). Also, change
> the values in corresponding call sites of the functions.
> 
> Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_cmd.c    | 8 ++++----
>  drivers/staging/rtl8723bs/os_dep/os_intfs.c | 4 ++--
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> index ab450f717f34..f8a4f910bfea 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> @@ -164,7 +164,7 @@ No irqsave is necessary.
>  
>  int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
>  {
> -	int res = _SUCCESS;
> +	int res = 0;
>  
>  	init_completion(&pcmdpriv->cmd_queue_comp);
>  	init_completion(&pcmdpriv->terminate_cmdthread_comp);
> @@ -178,7 +178,7 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
>  	pcmdpriv->cmd_allocated_buf = rtw_zmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ);
>  
>  	if (pcmdpriv->cmd_allocated_buf == NULL) {
> -		res = _FAIL;
> +		res = -ENOMEM;
>  		goto exit;
>  	}
>  
> @@ -187,7 +187,7 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
>  	pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4);
>  
>  	if (pcmdpriv->rsp_allocated_buf == NULL) {
> -		res = _FAIL;
> +		res = -ENOMEM;
>  		goto exit;
>  	}
>  
> @@ -203,7 +203,7 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
>  static void c2h_wk_callback(_workitem *work);
>  int rtw_init_evt_priv(struct evt_priv *pevtpriv)
>  {
> -	int res = _SUCCESS;
> +	int res = 0;
>  
>  	/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
>  	atomic_set(&pevtpriv->event_seq, 0);
> diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> index 143e3f9b31aa..6b3def0397f0 100644
> --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> @@ -757,7 +757,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
>  
>  	rtw_init_hal_com_default_value(padapter);
>  
> -	if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == _FAIL) {
> +	if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == -ENOMEM) {

No need to check for a specific error value, just _any_ error value.

>  		RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init cmd_priv\n"));
>  		ret8 = _FAIL;
>  		goto exit;
> @@ -765,7 +765,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
>  
>  	padapter->cmdpriv.padapter = padapter;
>  
> -	if ((rtw_init_evt_priv(&padapter->evtpriv)) == _FAIL) {
> +	if ((rtw_init_evt_priv(&padapter->evtpriv)) == -ENOMEM) {

Same here.

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/5] Issue suggested by Coccinelle using ret.cocci
  2019-03-17 21:33 [PATCH v2 0/5] Issue suggested by Coccinelle using ret.cocci Madhumitha Prabakaran
                   ` (4 preceding siblings ...)
  2019-03-17 21:33 ` [PATCH v2 5/5] Staging: rtl8723bs: Add missing NULL check for kmalloc Madhumitha Prabakaran
@ 2019-03-18  6:46 ` Greg KH
  5 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2019-03-18  6:46 UTC (permalink / raw)
  To: Madhumitha Prabakaran; +Cc: outreachy-kernel

On Sun, Mar 17, 2019 at 04:33:53PM -0500, Madhumitha Prabakaran wrote:
> This patchset does tasks as below:
> 1) Drop wrapper functions and change function names
> 2) Change type of variables and return type
> 3) Change values to standard error codes in functions
> 4) Replace NULL comparison with !
> 5) Add missing NULL check for kmalloc
> 
> All these patches are relevant to an issue suggested by Coccinelle using
> ret.cocci.
> 
> Madhumitha Prabakaran (5):
>   Staging: rtl8723bs: Remove wrapper functions and change function names
>   Staging: rtl8723bs: Change type of variables and return type
>   Staging: rtl8723bs:  Change values to standard error codes in
>     functions
>   Staging: rtl8723bs: Replace NULL comparison with !
>   Staging: rtl8723bs: Add missing NULL check for kmalloc

I applied the first two patches, please rebase and redo the remaining
ones.

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Outreachy kernel] [PATCH v2 3/5] Staging: rtl8723bs: Change values to standard error codes in functions
  2019-03-17 23:37     ` [Outreachy kernel] " Madhumthia Prabakaran
@ 2019-03-18  7:27       ` Julia Lawall
  0 siblings, 0 replies; 16+ messages in thread
From: Julia Lawall @ 2019-03-18  7:27 UTC (permalink / raw)
  To: Madhumthia Prabakaran; +Cc: outreachy-kernel

> > > -	if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == _FAIL) {
> > > +	if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == -ENOMEM) {
> > >  		RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init cmd_priv\n"));
> > >  		ret8 = _FAIL;
> > >  		goto exit;
> > > @@ -765,7 +765,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
> > >
> > >  	padapter->cmdpriv.padapter = padapter;
> > >
> > > -	if ((rtw_init_evt_priv(&padapter->evtpriv)) == _FAIL) {
> > > +	if ((rtw_init_evt_priv(&padapter->evtpriv)) == -ENOMEM) {

In addition to Greg's comment on this code, there are too many parentheses
as well.

julia


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Outreachy kernel] [PATCH v2 5/5] Staging: rtl8723bs: Add missing NULL check for kmalloc
  2019-03-17 23:42     ` Madhumthia Prabakaran
@ 2019-03-18  7:29       ` Julia Lawall
  0 siblings, 0 replies; 16+ messages in thread
From: Julia Lawall @ 2019-03-18  7:29 UTC (permalink / raw)
  To: Madhumthia Prabakaran; +Cc: outreachy-kernel



On Sun, 17 Mar 2019, Madhumthia Prabakaran wrote:

> On Sun, Mar 17, 2019 at 10:55:05PM +0100, Julia Lawall wrote:
> >
> >
> > On Sun, 17 Mar 2019, Madhumitha Prabakaran wrote:
> >
> > > Include missing NULL check for kmalloc in function rtw_init_evt_priv.
> > > Also, remove unnecessary local variable 'res' in the function and
> > > replace the value directly in the return of the function.
> >
> > These changes seem quite unrelated.  Dropping res was possible before any
> > of the other changes because its value was never updated, and if you make
> > your change, the value of res is not updated either.
>
> Yeah! But it is in same function, also res is not used anywhere in the
> function. So I removed it and changed the return type as return 0.

Same function doesn't mean that it needs to be in the same patch.  It is
quite fine to have it in the same series, because you in general are
changing these res values.

julia

>
> >
> > julia
> >
> > >
> > > Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> > > ---
> > >  drivers/staging/rtl8723bs/core/rtw_cmd.c | 7 ++++---
> > >  1 file changed, 4 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > index 3550de9f12c3..c76f27a6b3ab 100644
> > > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > @@ -203,8 +203,6 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
> > >  static void c2h_wk_callback(_workitem *work);
> > >  int rtw_init_evt_priv(struct evt_priv *pevtpriv)
> > >  {
> > > -	int res = 0;
> > > -
> > >  	/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
> > >  	atomic_set(&pevtpriv->event_seq, 0);
> > >  	pevtpriv->evt_done_cnt = 0;
> > > @@ -213,7 +211,10 @@ int rtw_init_evt_priv(struct evt_priv *pevtpriv)
> > >  	pevtpriv->c2h_wk_alive = false;
> > >  	pevtpriv->c2h_queue = rtw_cbuf_alloc(C2H_QUEUE_MAX_LEN+1);
> > >
> > > -	return res;
> > > +	if (!pevtpriv->c2h_queue)
> > > +		return -ENOMEM;
> > > +
> > > +	return 0;
> > >  }
> > >
> > >  void _rtw_free_evt_priv(struct	evt_priv *pevtpriv)
> > > --
> > > 2.17.1
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/4010080c4d3e2bd0ed50a747eff3d00c66eea169.1552858206.git.madhumithabiw%40gmail.com.
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903172254090.2434%40hadrien.
> > For more options, visit https://groups.google.com/d/optout.
>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Outreachy kernel] [PATCH v2 2/5] Staging: rtl8723bs: Change type of variables and return type
  2019-03-17 23:34     ` Madhumthia Prabakaran
@ 2019-03-18  7:30       ` Julia Lawall
  0 siblings, 0 replies; 16+ messages in thread
From: Julia Lawall @ 2019-03-18  7:30 UTC (permalink / raw)
  To: Madhumthia Prabakaran; +Cc: outreachy-kernel



On Sun, 17 Mar 2019, Madhumthia Prabakaran wrote:

> On Sun, Mar 17, 2019 at 10:52:35PM +0100, Julia Lawall wrote:
> >
> >
> > On Sun, 17 Mar 2019, Madhumitha Prabakaran wrote:
> >
> > > Change type of local variables 'res' and return type of functions
> > > 'rtw_init_cmd_pri' and 'rtw_init_evt_priv', as function's
> > > return types are defined for standard error codes _SUCCESS and _FAIL.
> >
> > I'm not sure to undestand the reference to _SUCCESS and _FAIL.  sint is a
> > typedef for signed int, but kernel code typically uses just int rather
> > than signed int.  In any case, the change doesn't have any impact on the
> > types in the code.
>
> That's true. Should I drop this patch?

No, no, the patch is good,and I think Greg may have already accepted it.
The comment was just about the log message.

julia

>
> thanks
>
> >
> > julia
> >
> > > Also, change return type of functions declarations corresponding to
> > > change made in function definitions.
> > >
> > > Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> > > ---
> > >  drivers/staging/rtl8723bs/core/rtw_cmd.c      | 8 ++++----
> > >  drivers/staging/rtl8723bs/include/cmd_osdep.h | 4 ++--
> > >  2 files changed, 6 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > index 793bc505fa9c..ab450f717f34 100644
> > > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > @@ -162,9 +162,9 @@ Caller and the rtw_cmd_thread can protect cmd_q by spin_lock.
> > >  No irqsave is necessary.
> > >  */
> > >
> > > -sint rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
> > > +int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
> > >  {
> > > -	sint res = _SUCCESS;
> > > +	int res = _SUCCESS;
> > >
> > >  	init_completion(&pcmdpriv->cmd_queue_comp);
> > >  	init_completion(&pcmdpriv->terminate_cmdthread_comp);
> > > @@ -201,9 +201,9 @@ sint rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv)
> > >  }
> > >
> > >  static void c2h_wk_callback(_workitem *work);
> > > -sint rtw_init_evt_priv(struct evt_priv *pevtpriv)
> > > +int rtw_init_evt_priv(struct evt_priv *pevtpriv)
> > >  {
> > > -	sint res = _SUCCESS;
> > > +	int res = _SUCCESS;
> > >
> > >  	/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
> > >  	atomic_set(&pevtpriv->event_seq, 0);
> > > diff --git a/drivers/staging/rtl8723bs/include/cmd_osdep.h b/drivers/staging/rtl8723bs/include/cmd_osdep.h
> > > index 8ed913726d5a..06ab48263757 100644
> > > --- a/drivers/staging/rtl8723bs/include/cmd_osdep.h
> > > +++ b/drivers/staging/rtl8723bs/include/cmd_osdep.h
> > > @@ -8,8 +8,8 @@
> > >  #define __CMD_OSDEP_H_
> > >
> > >
> > > -sint rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv);
> > > -sint rtw_init_evt_priv(struct evt_priv *pevtpriv);
> > > +int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv);
> > > +int rtw_init_evt_priv(struct evt_priv *pevtpriv);
> > >  extern void _rtw_free_evt_priv (struct	evt_priv *pevtpriv);
> > >  extern void _rtw_free_cmd_priv (struct	cmd_priv *pcmdpriv);
> > >  extern sint _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj);
> > > --
> > > 2.17.1
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/cce081516153acd64194786cb1373150172d73cf.1552858206.git.madhumithabiw%40gmail.com.
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903172250420.2434%40hadrien.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190317233426.GA4222%40madhuleo.
> For more options, visit https://groups.google.com/d/optout.
>


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-03-18  7:30 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-17 21:33 [PATCH v2 0/5] Issue suggested by Coccinelle using ret.cocci Madhumitha Prabakaran
2019-03-17 21:33 ` [PATCH v2 1/5] Staging: rtl8723bs: Remove wrapper functions and change function names Madhumitha Prabakaran
2019-03-17 21:33 ` [PATCH v2 2/5] Staging: rtl8723bs: Change type of variables and return type Madhumitha Prabakaran
2019-03-17 21:52   ` [Outreachy kernel] " Julia Lawall
2019-03-17 23:34     ` Madhumthia Prabakaran
2019-03-18  7:30       ` Julia Lawall
2019-03-17 21:33 ` [PATCH v2 3/5] Staging: rtl8723bs: Change values to standard error codes in functions Madhumitha Prabakaran
     [not found]   ` <alpine.DEB.2.21.1903172253010.2434@hadrien>
2019-03-17 23:37     ` [Outreachy kernel] " Madhumthia Prabakaran
2019-03-18  7:27       ` Julia Lawall
2019-03-18  6:42   ` Greg KH
2019-03-17 21:33 ` [PATCH v2 4/5] Staging: rtl8723bs: Replace NULL comparison with ! Madhumitha Prabakaran
2019-03-17 21:33 ` [PATCH v2 5/5] Staging: rtl8723bs: Add missing NULL check for kmalloc Madhumitha Prabakaran
2019-03-17 21:55   ` [Outreachy kernel] " Julia Lawall
2019-03-17 23:42     ` Madhumthia Prabakaran
2019-03-18  7:29       ` Julia Lawall
2019-03-18  6:46 ` [PATCH v2 0/5] Issue suggested by Coccinelle using ret.cocci Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.