[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8734tb8h1s.fsf@intel.com>
Date: Thu, 29 Feb 2024 16:46:07 +0200
From: Jani Nikula <jani.nikula@...ux.intel.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>, Rodrigo Vivi
<rodrigo.vivi@...el.com>, Joonas Lahtinen
<joonas.lahtinen@...ux.intel.com>, Tvrtko Ursulin
<tvrtko.ursulin@...ux.intel.com>, David Airlie <airlied@...il.com>, Daniel
Vetter <daniel@...ll.ch>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
intel-gfx@...ts.freedesktop.org, intel-xe@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH] drm/i915/display: Save a few bytes of memory in
intel_backlight_device_register()
On Fri, 23 Feb 2024, Christophe JAILLET <christophe.jaillet@...adoo.fr> wrote:
> 'name' may still be "intel_backlight" when backlight_device_register() is
> called.
> In such a case, using kstrdup_const() saves a memory duplication when
> dev_set_name() is called in backlight_device_register().
>
> Use kfree_const() accordingly.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Thanks, pushed to drm-intel-next.
BR,
Jani.
> ---
> Compile tested only
> ---
> drivers/gpu/drm/i915/display/intel_backlight.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_backlight.c b/drivers/gpu/drm/i915/display/intel_backlight.c
> index 1946d7fb3c2e..9e4a9d4f1585 100644
> --- a/drivers/gpu/drm/i915/display/intel_backlight.c
> +++ b/drivers/gpu/drm/i915/display/intel_backlight.c
> @@ -949,7 +949,7 @@ int intel_backlight_device_register(struct intel_connector *connector)
> else
> props.power = FB_BLANK_POWERDOWN;
>
> - name = kstrdup("intel_backlight", GFP_KERNEL);
> + name = kstrdup_const("intel_backlight", GFP_KERNEL);
> if (!name)
> return -ENOMEM;
>
> @@ -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(name);
> + kfree_const(name);
> name = kasprintf(GFP_KERNEL, "card%d-%s-backlight",
> i915->drm.primary->index, connector->base.name);
> if (!name)
> @@ -987,7 +987,7 @@ int intel_backlight_device_register(struct intel_connector *connector)
> connector->base.base.id, connector->base.name, name);
>
> out:
> - kfree(name);
> + kfree_const(name);
>
> return ret;
> }
--
Jani Nikula, Intel
Powered by blists - more mailing lists