mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Jani Nikula <jani.nikula@linux.intel.com>,
	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, 2 Oct 2024 18:43:32 +0200	[thread overview]
Message-ID: <86f6269f-e367-4192-ab71-5d82b1c88309@wanadoo.fr> (raw)
In-Reply-To: <87cykiu3hk.fsf@intel.com>

Le 02/10/2024 à 13:51, Jani Nikula a écrit :
> 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.
> 
> 

Will do.

CJ

      reply	other threads:[~2024-10-02 16:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-28 14:28 Christophe JAILLET
2024-09-30  7:48 ` Jani Nikula
2024-10-01 18:34   ` Christophe JAILLET
2024-10-02 11:51     ` Jani Nikula
2024-10-02 16:43       ` Christophe JAILLET [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=86f6269f-e367-4192-ab71-5d82b1c88309@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --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

all inboxes | Powered by JetHome®