public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ivan Safonov <insafonov@gmail.com>
To: Johnny Kim <johnny.kim@atmel.com>
Cc: Austin Shin <austin.shin@atmel.com>,
	Chris Park <chris.park@atmel.com>, Tony Cho <tony.cho@atmel.com>,
	Glen Lee <glen.lee@atmel.com>, Leo Kim <leo.kim@atmel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] staging: wilc1000: wilc_parse_network_info refactoring
Date: Sun, 27 Dec 2015 23:59:57 +0700	[thread overview]
Message-ID: <20151227165957.GA22276@alpha.sfu-kras.ru> (raw)

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


             reply	other threads:[~2015-12-27 16:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-27 16:59 Ivan Safonov [this message]
2016-02-03 23:09 ` [PATCH 2/2] staging: wilc1000: wilc_parse_network_info refactoring Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151227165957.GA22276@alpha.sfu-kras.ru \
    --to=insafonov@gmail.com \
    --cc=austin.shin@atmel.com \
    --cc=chris.park@atmel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=glen.lee@atmel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johnny.kim@atmel.com \
    --cc=leo.kim@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=tony.cho@atmel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox