linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Chaehyun Lim <chaehyun.lim@gmail.com>
Cc: johnny.kim@atmel.com, rachel.kim@atmel.com, dean.lee@atmel.com,
	chris.park@atmel.com, linux-wireless@vger.kernel.org,
	devel@driverdev.osuosl.org
Subject: Re: [PATCH 2/2] staging: wilc1000: fix memory allocation error check
Date: Tue, 14 Jul 2015 16:43:28 -0700	[thread overview]
Message-ID: <20150714234328.GA6948@kroah.com> (raw)
In-Reply-To: <CAKV=isu0C5i2Epjh51QQ3=GgDN9jqd9LDYQ0o1rO6cSBL_eVEQ@mail.gmail.com>

On Wed, Jul 15, 2015 at 08:14:08AM +0900, Chaehyun Lim wrote:
> On Wed, Jul 15, 2015 at 6:16 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Tue, Jul 14, 2015 at 10:48:41AM +0900, Chaehyun Lim wrote:
> >> Remove WILC_ERRORREPORT macro. If memory allocation is failed,
> >> jump to a label to return this function with WILC_NO_MEM.
> >>
> >> Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
> >> ---
> >>  drivers/staging/wilc1000/host_interface.c | 7 +++++--
> >>  1 file changed, 5 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
> >> index ca97b70..f6ba7d1 100644
> >> --- a/drivers/staging/wilc1000/host_interface.c
> >> +++ b/drivers/staging/wilc1000/host_interface.c
> >> @@ -7142,8 +7142,11 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval,
> >>       /* Bug 4599 : if tail length = 0 skip allocating & copying */
> >>       if (u32TailLen > 0) {
> >>               pstrSetBeaconParam->pu8Tail = (u8 *)WILC_MALLOC(u32TailLen);
> >> -             if (pstrSetBeaconParam->pu8Tail == NULL)
> >> -                     WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
> >> +             if (pstrSetBeaconParam->pu8Tail == NULL) {
> >> +                     PRINT_ER("Failed to allocate memory\n");
> >
> > This message is redundant, the core already just told the user this, so
> > it's not needed to tell them this again.
> >
> > And as an aside, the mess in WILC_MALLOC() needs to go as well, that's
> > horrid, and wrong :(
> 
> Thank you for your comment. You think WILC_MALLOC() should be changed.
> Could you give me a direction how this function should be changed?

Hm, let me turn the question around, why do you think it should be there
at all?

thanks,

greg k-h

  reply	other threads:[~2015-07-14 23:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14  1:48 [PATCH 1/2] staging: wilc1000: fix uninitialized variablie warning Chaehyun Lim
2015-07-14  1:48 ` [PATCH 2/2] staging: wilc1000: fix memory allocation error check Chaehyun Lim
2015-07-14 21:16   ` Greg KH
2015-07-14 23:14     ` Chaehyun Lim
2015-07-14 23:43       ` Greg KH [this message]
2015-07-14  2:32 ` [PATCH 1/2] staging: wilc1000: fix uninitialized variablie warning Julian Calaby

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=20150714234328.GA6948@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=chaehyun.lim@gmail.com \
    --cc=chris.park@atmel.com \
    --cc=dean.lee@atmel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=johnny.kim@atmel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rachel.kim@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;
as well as URLs for NNTP newsgroup(s).