Skip to content

Commit

Permalink
drm/i915/display: Remove kstrdup_const() and kfree_const() usage
Browse files Browse the repository at this point in the history
kstrdup_const() and kfree_const() can be confusing in code built as a
module. In such a case, it does not do what one could expect from the name
of the functions.

The code is not wrong by itself, but in such a case, it is equivalent to
kstrdup() and kfree().

So, keep thinks simple and straightforward.

This reverts commit 379b63e ("drm/i915/display: Save a few bytes of
memory in intel_backlight_device_register()")

Signed-off-by: Christophe JAILLET <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/f82be2ee3ac7d18dd9982b5368a88a5bf2aeb777.1727977199.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jani Nikula <[email protected]>
  • Loading branch information
tititiou36 authored and jnikula committed Oct 22, 2024
1 parent 15d3f14 commit 5367156
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/display/intel_backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ int intel_backlight_device_register(struct intel_connector *connector)
else
props.power = BACKLIGHT_POWER_OFF;

name = kstrdup_const("intel_backlight", GFP_KERNEL);
name = kstrdup("intel_backlight", GFP_KERNEL);
if (!name)
return -ENOMEM;

Expand All @@ -963,7 +963,7 @@ int intel_backlight_device_register(struct intel_connector *connector)
* compatibility. Use unique names for subsequent backlight devices as a
* fallback when the default name already exists.
*/
kfree_const(name);
kfree(name);
name = kasprintf(GFP_KERNEL, "card%d-%s-backlight",
i915->drm.primary->index, connector->base.name);
if (!name)
Expand All @@ -987,7 +987,7 @@ int intel_backlight_device_register(struct intel_connector *connector)
connector->base.base.id, connector->base.name, name);

out:
kfree_const(name);
kfree(name);

return ret;
}
Expand Down

0 comments on commit 5367156

Please sign in to comment.