All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julian Calaby <julian.calaby@gmail.com>
To: Leo Kim <leo.kim@atmel.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	linux-wireless <linux-wireless@vger.kernel.org>,
	Tony Cho <tony.cho@atmel.com>, Glen Lee <glen.lee@atmel.com>,
	Austin Shin <austin.shin@atmel.com>,
	Chris Park <Chris.Park@atmel.com>,
	adham.abozaeid@atmel.com, Nicolas.FERRE@atmel.com
Subject: Re: [PATCH 08/12] staging: wilc1000: rename variable s32Error
Date: Fri, 29 Jan 2016 11:55:10 +1100	[thread overview]
Message-ID: <CAGRGNgXxcZBzOkJa++pAHWZLAZs9wrD48cEiGhzKatmzd+usRw@mail.gmail.com> (raw)
In-Reply-To: <1453965226-6158-8-git-send-email-leo.kim@atmel.com>

Hi Leo,

On Thu, Jan 28, 2016 at 6:13 PM, Leo Kim <leo.kim@atmel.com> wrote:
> This patch renames variable s32Error to result
> to avoid CamelCase naming convention.
> Also, remove the unused variable s32Error and replace with direct return.
>
> Signed-off-by: Leo Kim <leo.kim@atmel.com>
> ---
>  drivers/staging/wilc1000/coreconfigurator.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
> index 2a4e324..88e5661 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.c
> +++ b/drivers/staging/wilc1000/coreconfigurator.c
> @@ -356,30 +356,29 @@ s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info)
>
>  s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
>  {
> -       s32 s32Error = 0;
> +       s32 result = 0;
>
>         if (pstrNetworkInfo) {
>                 if (pstrNetworkInfo->pu8IEs) {
>                         kfree(pstrNetworkInfo->pu8IEs);
>                         pstrNetworkInfo->pu8IEs = NULL;

I'm not sure it's necessary to set this to NULL here.

>                 } else {
> -                       s32Error = -EFAULT;
> +                       result = -EFAULT;
>                 }
>
>                 kfree(pstrNetworkInfo);
>                 pstrNetworkInfo = NULL;

Or this to NULL here.

Also, is the return value from this function actually checked? kfree()
can have NULL passed to it.

If the return value isn't checked, this entire function could be simplified to:

- - - - -

if (pstrNetworkInfo) {
    kfree(pstrNetworkInfo->pu8IEs);
    kfree(pstrNetworkInfo);
}

return 0;

- - - - -

Also, when tstrNetworkInfo structs are allocated, wouldn't the
allocating function fail if ->pu8IEs is NULL?

>         } else {
> -               s32Error = -EFAULT;
> +               result = -EFAULT;
>         }
>
> -       return s32Error;
> +       return result;
>  }
>
>  s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
>                                tstrConnectRespInfo **ppstrConnectRespInfo)
>  {
> -       s32 s32Error = 0;
>         tstrConnectRespInfo *pstrConnectRespInfo = NULL;
>         u16 u16AssocRespLen = 0;
>         u8 *pu8IEs = NULL;
> @@ -408,27 +407,27 @@ s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
>
>         *ppstrConnectRespInfo = pstrConnectRespInfo;
>
> -       return s32Error;
> +       return 0;
>  }
>
>  s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)
>  {
> -       s32 s32Error = 0;
> +       s32 result = 0;

All the comments above apply to this function as well.

>
>         if (pstrConnectRespInfo) {
>                 if (pstrConnectRespInfo->pu8RespIEs) {
>                         kfree(pstrConnectRespInfo->pu8RespIEs);
>                         pstrConnectRespInfo->pu8RespIEs = NULL;
>                 } else {
> -                       s32Error = -EFAULT;
> +                       result = -EFAULT;
>                 }
>
>                 kfree(pstrConnectRespInfo);
>                 pstrConnectRespInfo = NULL;
>
>         } else {
> -               s32Error = -EFAULT;
> +               result = -EFAULT;
>         }
>
> -       return s32Error;
> +       return result;
>  }

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

  reply	other threads:[~2016-01-29  0:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-28  7:13 [PATCH 01/12] staging: wilc1000: coreconfigurator.c : remove over-commenting Leo Kim
2016-01-28  7:13 ` [PATCH 02/12] staging: wilc1000: renames u16RxLen variable Leo Kim
2016-01-28  7:13 ` [PATCH 03/12] staging: wilc1000: renames u16TagParamOffset variable Leo Kim
2016-01-28  7:13 ` [PATCH 04/12] staging: wilc1000: renames u16index variable Leo Kim
2016-01-28  7:13 ` [PATCH 05/12] staging: wilc1000: wilc_parse_network_info(): renames function variables Leo Kim
2016-02-03 23:30   ` Greg KH
2016-01-28  7:13 ` [PATCH 06/12] staging: wilc1000: wilc_parse_network_info(): renames local variables Leo Kim
2016-01-28  7:13 ` [PATCH 07/12] staging: wilc1000: wilc_parse_network_info(): renames local inner variables Leo Kim
2016-01-28  7:13 ` [PATCH 08/12] staging: wilc1000: rename variable s32Error Leo Kim
2016-01-29  0:55   ` Julian Calaby [this message]
2016-01-29  2:55     ` Kim, Leo
2016-01-29  2:58       ` Julian Calaby
2016-01-28  7:13 ` [PATCH 09/12] staging: wilc1000: wilc_parse_assoc_resp_info(): renames function variables Leo Kim
2016-01-28  7:13 ` [PATCH 10/12] staging: wilc1000: wilc_parse_assoc_resp_info(): renames local variables Leo Kim
2016-01-28  7:13 ` [PATCH 11/12] staging: wilc1000: wilc_dealloc_assoc_resp_info(): renames function variables Leo Kim
2016-01-28  7:13 ` [PATCH 12/12] staging: wilc1000: wilc_dealloc_network_info(): " Leo Kim

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=CAGRGNgXxcZBzOkJa++pAHWZLAZs9wrD48cEiGhzKatmzd+usRw@mail.gmail.com \
    --to=julian.calaby@gmail.com \
    --cc=Chris.Park@atmel.com \
    --cc=Nicolas.FERRE@atmel.com \
    --cc=adham.abozaeid@atmel.com \
    --cc=austin.shin@atmel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=glen.lee@atmel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=leo.kim@atmel.com \
    --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 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.