From: Jani Nikula <jani.nikula@linux.intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Tvrtko Ursulin <tursulin@ursulin.net>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/backlight: Remove a useless kstrdup_const()
Date: Wed, 02 Oct 2024 14:51:51 +0300 [thread overview]
Message-ID: <87cykiu3hk.fsf@intel.com> (raw)
In-Reply-To: <3c793f42-6cd1-40e7-a3f2-556b6e5b4094@wanadoo.fr>
On Tue, 01 Oct 2024, Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> Le 30/09/2024 à 09:48, Jani Nikula a écrit :
>> On Sat, 28 Sep 2024, Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
>>> "name" is allocated and freed in intel_backlight_device_register().
>>> The initial allocation just duplicates "intel_backlight".
>>>
>>> Later, if a device with this name has already been registered, another
>>> dynamically generated one is allocated using kasprintf().
>>>
>>> So at the end of the function, when "name" is freed, it can point either to
>>> the initial static literal "intel_backlight" or to the kasprintf()'ed one.
>>>
>>> So kfree_const() is used.
>>>
>>> However, when built as a module, kstrdup_const() and kfree_const() don't
>>> work as one would expect and are just plain kstrdup() and kfree().
>>>
>>>
>>> Slightly change the logic and introduce a new variable to hold the
>>> address returned by kasprintf() should it be used.
>>>
>>> This saves a memory allocation/free and avoids these _const functions,
>>> which names can be confusing when used with code built as module.
>>
>> Okay, I'd rather revert your earlier commit 379b63e7e682
>> ("drm/i915/display: Save a few bytes of memory in
>> intel_backlight_device_register()") than add this.
>
> Hi,
>
> that works for me. Thanks and sorry for the noise.
Will you send the revert?
BR,
Jani.
--
Jani Nikula, Intel
next prev parent reply other threads:[~2024-10-02 11:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-28 14:28 [PATCH] drm/i915/backlight: Remove a useless kstrdup_const() Christophe JAILLET
2024-09-28 14:43 ` ✓ CI.Patch_applied: success for " Patchwork
2024-09-28 14:43 ` ✓ CI.checkpatch: " Patchwork
2024-09-28 14:44 ` ✓ CI.KUnit: " Patchwork
2024-09-28 14:56 ` ✓ CI.Build: " Patchwork
2024-09-28 14:58 ` ✓ CI.Hooks: " Patchwork
2024-09-28 15:00 ` ✗ CI.checksparse: warning " Patchwork
2024-09-28 15:17 ` ✓ CI.BAT: success " Patchwork
2024-09-30 7:18 ` ✗ CI.FULL: failure " Patchwork
2024-09-30 7:48 ` [PATCH] " Jani Nikula
2024-10-01 18:34 ` Christophe JAILLET
2024-10-02 11:51 ` Jani Nikula [this message]
2024-10-02 16:43 ` Christophe JAILLET
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=87cykiu3hk.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=airlied@gmail.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=tursulin@ursulin.net \
/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).