From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Joe Perches <joe@perches.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Hans de Goede <hdegoede@redhat.com>,
Wolfram Sang <wsa@the-dreams.de>
Subject: Re: [PATCH v4 3/4] device property: constify property arrays values
Date: Thu, 2 Feb 2017 16:16:48 -0800 [thread overview]
Message-ID: <20170203001648.GA12651@dtor-ws> (raw)
In-Reply-To: <CAJZ5v0jB_8LXPR7Uj0j5gyTo+Bdk9Sud+9jreA4VT9+QsB5ieA@mail.gmail.com>
On Fri, Feb 03, 2017 at 12:16:29AM +0100, Rafael J. Wysocki wrote:
> On Thu, Feb 2, 2017 at 7:38 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > On Thu, Feb 02, 2017 at 07:52:58PM +0200, Andy Shevchenko wrote:
> >> On Thu, 2017-02-02 at 09:07 -0800, Dmitry Torokhov wrote:
> >> > On February 2, 2017 8:48:30 AM PST, Andy Shevchenko <andriy.shevchenko
> >> > @linux.intel.com> wrote:
> >> > > On Thu, 2017-02-02 at 08:39 -0800, Dmitry Torokhov wrote:
> >> > > > From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> >> > > >
> >> > > > Data that is fed into property arrays should not be modified, so
> >> > >
> >> > > let's
> >> > > > mark
> >> > > > relevant pointers as const. This will allow us making source
> >> > > > arrays
> >> > >
> >> > > as
> >> > > > const/__initconst.
> >> > > >
> >> > > > Also fix memory leaks on errors in property_entry_copy().
> >> > >
> >> > > While the code looks okay, I'm not sure what memory leaks you are
> >> > > referring to. The idea as far as I remember was to run *free()
> >> > > function
> >> > > if *copy() fails.
> >> >
> >> > That could have been OK for internal function, but will not work for
> >> > public API, as it goes against normal pattern.
>
> But it is an internal function, isn't it?
>
> Also its only caller does the right thing AFAICS.
No, actually property_entries_dup() does not do the right thing anymore
:(.
>
> >> > You will be old and grey and still correcting patches that would be
> >> > getting it wrong :)
> >>
> >> Yes, which sounds not exactly as "we have memory leaks and here we are
> >> fixing them". So, my comment regarding to phrasing of the commit
> >> message. Someone might mistakenly think that it needs to be ported as
> >> earlier as this had been introduced.
> >
> > OK, I'll leave it up to Rafael to massage the commit message as he sees
> > fit.
>
> To be precise, there are no memory leaks and this is just adding an
> unnecessary label along with some code around it, equally unnecessary.
>
> Are you planning on making property_entry_copy() non-static?
Maybe, but not yet. Still, I am uncomfortable with functions not
cleaning up but rather requiring leaving failed property structure in
such state that cleanup function will not crash on it. I think it is
fragile and I'd rather rework it so we clean up on the spot.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2017-02-03 0:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-01 17:31 [PATCH v3 0/4] Export APIs to copy device properties & more Dmitry Torokhov
2017-02-01 17:31 ` [PATCH v3 1/4] device property: export code duplicating array of property entries Dmitry Torokhov
2017-02-01 17:31 ` [PATCH v3 2/4] device property: allow to constify properties Dmitry Torokhov
2017-02-01 17:31 ` [PATCH v3 3/4] driver property: constify property arrays values Dmitry Torokhov
2017-02-01 23:30 ` Joe Perches
2017-02-02 11:24 ` Rafael J. Wysocki
2017-02-02 16:39 ` [PATCH v4 3/4] device " Dmitry Torokhov
2017-02-02 16:48 ` Andy Shevchenko
2017-02-02 17:07 ` Dmitry Torokhov
2017-02-02 17:52 ` Andy Shevchenko
2017-02-02 18:38 ` Dmitry Torokhov
2017-02-02 23:16 ` Rafael J. Wysocki
2017-02-03 0:16 ` Dmitry Torokhov [this message]
2017-02-03 0:37 ` Rafael J. Wysocki
2017-02-03 1:06 ` Dmitry Torokhov
2017-02-02 10:08 ` [PATCH v3 3/4] driver " Mika Westerberg
2017-02-01 17:31 ` [PATCH v3 4/4] i2c: allow specify device properties in i2c_board_info Dmitry Torokhov
2017-02-02 10:08 ` Mika Westerberg
2017-02-01 22:56 ` [PATCH v3 0/4] Export APIs to copy device properties & more Dmitry Torokhov
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=20170203001648.GA12651@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=joe@perches.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
--cc=wsa@the-dreams.de \
/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