linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] staging: wilc1000: wilc_parse_network_info refactoring
@ 2015-12-27 16:59 Ivan Safonov
  2016-02-03 23:09 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Ivan Safonov @ 2015-12-27 16:59 UTC (permalink / raw)
  To: Johnny Kim
  Cc: Austin Shin, Chris Park, Tony Cho, Glen Lee, Leo Kim,
	Greg Kroah-Hartman, linux-wireless, devel, linux-kernel

1) Return value of this function does not used;
2) wilc_parse_network_info has no reasons to return an error;
3) kfree does not free memory if argument is NULL.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
---
 drivers/staging/wilc1000/coreconfigurator.c | 27 +++++----------------------
 drivers/staging/wilc1000/coreconfigurator.h |  2 +-
 2 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 2d4d3f1..a36918c 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -458,34 +458,17 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo
 
 /**
  *  @brief              Deallocates the parsed Network Info
- *  @details
  *  @param[in]  pstrNetworkInfo Network Info to be deallocated
- *  @return             Error code indicating success/failure
- *  @note
  *  @author		mabubakr
  *  @date		1 Mar 2012
- *  @version		1.0
  */
-s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
+void wilc_dealloc_network_info(tstrNetworkInfo *network_info)
 {
-	s32 s32Error = 0;
+	if (!network_info)
+		return;
 
-	if (pstrNetworkInfo) {
-		if (pstrNetworkInfo->pu8IEs) {
-			kfree(pstrNetworkInfo->pu8IEs);
-			pstrNetworkInfo->pu8IEs = NULL;
-		} else {
-			s32Error = -EFAULT;
-		}
-
-		kfree(pstrNetworkInfo);
-		pstrNetworkInfo = NULL;
-
-	} else {
-		s32Error = -EFAULT;
-	}
-
-	return s32Error;
+	kfree(network_info->pu8IEs);
+	kfree(network_info);
 }
 
 /**
diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index fc43d04..8c28c6b 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -130,7 +130,7 @@ typedef struct {
 s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
 			 u32 count, u32 drv);
 s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
-s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
+void wilc_dealloc_network_info(tstrNetworkInfo *network_info);
 
 s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
 		       tstrConnectRespInfo **ppstrConnectRespInfo);
-- 
2.4.10


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

* Re: [PATCH 2/2] staging: wilc1000: wilc_parse_network_info refactoring
  2015-12-27 16:59 [PATCH 2/2] staging: wilc1000: wilc_parse_network_info refactoring Ivan Safonov
@ 2016-02-03 23:09 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2016-02-03 23:09 UTC (permalink / raw)
  To: Ivan Safonov
  Cc: Johnny Kim, Austin Shin, Chris Park, Tony Cho, Glen Lee, Leo Kim,
	linux-wireless, devel, linux-kernel

On Sun, Dec 27, 2015 at 11:59:57PM +0700, Ivan Safonov wrote:
> 1) Return value of this function does not used;
> 2) wilc_parse_network_info has no reasons to return an error;
> 3) kfree does not free memory if argument is NULL.
> 
> Signed-off-by: Ivan Safonov <insafonov@gmail.com>
> ---
>  drivers/staging/wilc1000/coreconfigurator.c | 27 +++++----------------------
>  drivers/staging/wilc1000/coreconfigurator.h |  2 +-
>  2 files changed, 6 insertions(+), 23 deletions(-)

You sent 3 different copies of this same patch, so I don't know which to
apply :(

Please fix up and resend the series properly...

thanks,

greg k-h

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

end of thread, other threads:[~2016-02-03 23:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-27 16:59 [PATCH 2/2] staging: wilc1000: wilc_parse_network_info refactoring Ivan Safonov
2016-02-03 23:09 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).