From patchwork Sun Dec 27 16:59:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Safonov X-Patchwork-Id: 7923931 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1FF409F318 for ; Sun, 27 Dec 2015 16:58:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 50B4C2026F for ; Sun, 27 Dec 2015 16:58:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6EB9220218 for ; Sun, 27 Dec 2015 16:58:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752871AbbL0Q6E (ORCPT ); Sun, 27 Dec 2015 11:58:04 -0500 Received: from mail-lf0-f46.google.com ([209.85.215.46]:32858 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750918AbbL0Q6D (ORCPT ); Sun, 27 Dec 2015 11:58:03 -0500 Received: by mail-lf0-f46.google.com with SMTP id p203so191085156lfa.0; Sun, 27 Dec 2015 08:58:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=oBWdIIH3jdbv+zKebM0HTpG99t2wCVCmYnEHHMtJgVg=; b=wfWDfFbEAbj5ewL1BKH/EMnHfHMCFnBAv9oysKt+WfFqSib2ayPNatcN2U9s0vYw3z 6zaiPw/fHyf0vW6v8MuPsx5OlgD9hBrlp+96hJlk3wPBFB9ejM1r1tayNlzyn5MjELBO nia0tdyGlYW3NkArmGY0fDfZRgS3ZeNTZadFvpZcf6+FzXEhyTWzW9PRN3szM64wim5F KD4UxtdNuw1ouxwxhKy2GXfHhb/BkJE6kUQ2CmrZBPwjiSshJBSSm4wAvwNB1NKtNZXi 7WieCCNOvlbr6g1sviLSEA/bjt3f+iG96ef8g+PPt/V7aN6gpdnurvBSwis9S+vX4vxM EKMw== X-Received: by 10.25.37.198 with SMTP id l189mr17919929lfl.111.1451235481200; Sun, 27 Dec 2015 08:58:01 -0800 (PST) Received: from alpha ([193.218.138.55]) by smtp.gmail.com with ESMTPSA id un3sm9734700lbc.28.2015.12.27.08.57.57 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 27 Dec 2015 08:57:58 -0800 (PST) Received: (nullmailer pid 22280 invoked by uid 1000); Sun, 27 Dec 2015 16:59:57 -0000 Date: Sun, 27 Dec 2015 23:59:57 +0700 From: Ivan Safonov To: Johnny Kim Cc: Austin Shin , Chris Park , Tony Cho , Glen Lee , Leo Kim , Greg Kroah-Hartman , 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 Message-ID: <20151227165957.GA22276@alpha.sfu-kras.ru> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);