All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arvind Yadav <arvind.yadav.cs@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] driver core: Free memory obtained by kzalloc
Date: Thu, 1 Mar 2018 16:54:48 +0530	[thread overview]
Message-ID: <4f693209-db25-2dfb-1018-3dcbe806104f@gmail.com> (raw)
In-Reply-To: <CAHp75VeiUccZp7fLeRv9d2qt61Ha=CPEo2rwKypY42WGO4Aejw@mail.gmail.com>

Hi Andy,

sorry for noise.

On Thursday 01 March 2018 04:24 PM, Andy Shevchenko wrote:
> On Thu, Mar 1, 2018 at 7:59 AM, Arvind Yadav <arvind.yadav.cs@gmail.com> wrote:
>> Here kfree() is taking NULL. So moving 'dev = NULL' after kfree().
> Ouch! Does system_root_device_release() code ring a bell? How did you test this?
Yes, This is fine. put_device() will decrement a ref count.
So No need to call kfree() after put_device().
>
> When you start eventually looking to the code?
>
> NAK.
>
>> diff --git a/drivers/base/bus.c b/drivers/base/bus.c
>> index ef61833..ccb64a0 100644
>> --- a/drivers/base/bus.c
>> +++ b/drivers/base/bus.c
>> @@ -1170,9 +1170,9 @@ static int subsys_register(struct bus_type *subsys,
>>
>>   err_dev_reg:
>>          put_device(dev);
>> -       dev = NULL;
>>   err_name:
>>          kfree(dev);
>> +       dev = NULL;
>>   err_dev:
>>          bus_unregister(subsys);
>>          return err;
Thanks for your review.
>
>

      reply	other threads:[~2018-03-01 11:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-01  5:59 [PATCH] driver core: Free memory obtained by kzalloc Arvind Yadav
2018-03-01 10:54 ` Andy Shevchenko
2018-03-01 11:24   ` Arvind Yadav [this message]

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=4f693209-db25-2dfb-1018-3dcbe806104f@gmail.com \
    --to=arvind.yadav.cs@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.