Le 02/10/2024 à 13:51, Jani Nikula a écrit :
On Tue, 01 Oct 2024, Christophe JAILLET <christophe.jail...@wanadoo.fr> wrote:
Le 30/09/2024 à 09:48, Jani Nikula a écrit :
On Sat, 28 Sep 2024, Christophe JAILLET <christophe.jail...@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 via email to