[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9a9e84bf64fc95840ff852aeb276ef8f724b60be.camel@perches.com>
Date: Sun, 17 Dec 2023 05:41:12 -0800
From: Joe Perches <joe@...ches.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: Justin Stitt <justinstitt@...gle.com>, Lars-Peter Clausen
<lars@...afoo.de>, Stephen Boyd <swboyd@...omium.org>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v3] iio: sx9324: avoid copying property strings
On Sun, 2023-12-17 at 13:24 +0000, Jonathan Cameron wrote:
> On Mon, 11 Dec 2023 22:30:12 -0800
> Joe Perches <joe@...ches.com> wrote:
>
> > On Tue, 2023-12-12 at 00:42 +0000, Justin Stitt wrote:
> > > We're doing some needless string copies when trying to assign the proper
> > > `prop` string. We can make `prop` a const char* and simply assign to
> > > string literals.
> >
> > trivia:
> >
> > I would have updated it like this moving the
> > various declarations into the case blocks
> > where they are used and removing a few unused
> > #defines
>
> I'd definitely like to see those defines gone.
> Arguably an unrelated change as I guess they are left from a previous refactor
> of this code.
>
> Why prop to type renaming?
random, no specific need, though I prefer not reusing
identifiers with different types in separate local scopes.
> It's getting passed into calls where the parameter
> is propname so I'd understand renaming to that, but type just seems a bit random
> to me. I do wonder if we are better off having some long lines and getting rid
> of the property naming local variables completely by just duplicating
> the device_property_read_u32() call and passing them in directly.
maybe, give it a try and see what you think.
Powered by blists - more mailing lists