mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Timur Tabi <ttabi@nvidia.com>,
	"christophe.jaillet@wanadoo.fr" <christophe.jaillet@wanadoo.fr>,
	"philip.li@intel.com" <philip.li@intel.com>,
	"simona@ffwll.ch" <simona@ffwll.ch>,
	"lyude@redhat.com" <lyude@redhat.com>,
	"pierre.morrow@free.fr" <pierre.morrow@free.fr>,
	"airlied@gmail.com" <airlied@gmail.com>,
	"dakr@kernel.org" <dakr@kernel.org>,
	Ben Skeggs <bskeggs@nvidia.com>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"nouveau@lists.freedesktop.org" <nouveau@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/nouveau/bl: Use kasprintf for interface name
Date: Wed, 4 Jun 2025 15:16:40 -0700	[thread overview]
Message-ID: <24f7d99d-3249-4fcf-a9e4-af610cc9436b@intel.com> (raw)
In-Reply-To: <704b69a6af32e0d89a6d88051c12f29fdadfa638.camel@nvidia.com>



On 6/4/2025 3:01 PM, Timur Tabi wrote:
> On Wed, 2025-06-04 at 14:03 -0700, Jacob Keller wrote:
>> This could also be fixed by simply increasing BL_NAME_SIZE to 24, making it
>> large enough to fit any size integer into its format string, or by checking
>> the return value of snprintf.
> 
> I think this would be a better approach.  backlist_name[24] is still small enough to fit on the
> stack with ease, and it would eliminate the alloc/free churn.  kasprintf() should be reserved for
> long-term or larger allocations, IMHO.

Fair enough. Another alternative which saves the stack and macro would
be to add a new version of backlight_register_device which can pass the
integer number itself into dev_set_name, but thats probably not worth
the churn either. (Currently we snprintf into a buffer and then again
copy that again into the device name...)

Thanks,
Jake

  reply	other threads:[~2025-06-04 22:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-04 21:03 Jacob Keller
2025-06-04 22:01 ` Timur Tabi
2025-06-04 22:16   ` Jacob Keller [this message]
2025-06-04 22:40     ` Timur Tabi
2025-06-04 22:46       ` Jacob Keller

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=24f7d99d-3249-4fcf-a9e4-af610cc9436b@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=airlied@gmail.com \
    --cc=bskeggs@nvidia.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=philip.li@intel.com \
    --cc=pierre.morrow@free.fr \
    --cc=simona@ffwll.ch \
    --cc=ttabi@nvidia.com \
    /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®