public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Gui-Dong Han" <hanguidong02@gmail.com>
Cc: <gregkh@linuxfoundation.org>, <rafael@kernel.org>,
	<driver-core@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<akaieurus@qq.com>, "Geert Uytterhoeven" <geert@linux-m68k.org>
Subject: Re: [PATCH] driver core: simplify __device_set_driver_override() clearing logic
Date: Mon, 30 Mar 2026 15:55:01 +0200	[thread overview]
Message-ID: <DHG627388EQG.3B3ZMSK2FQHUM@kernel.org> (raw)
In-Reply-To: <20260325090905.169000-1-hanguidong02@gmail.com>

On Wed Mar 25, 2026 at 10:09 AM CET, Gui-Dong Han wrote:
> Currently, __device_set_driver_override() handles clearing the override
> via empty string ("") and newline ("\n") in two separate paths. The "\n"
> case also performs an unnecessary memory allocation and immediate free.
>
> Simplify the logic by initializing 'new' to NULL and only allocating
> memory if the string length remains non-zero after stripping the
> trailing newline.
>
> Reduce code size, improve readability, and avoid unnecessary memory
> operations.
>
> No functional change intended.
>
> Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Link: https://lore.kernel.org/driver-core/DGS82WWLXPJ0.2EH4VJSF30UR5@kernel.org/
> Signed-off-by: Gui-Dong Han <hanguidong02@gmail.com>

Applied to driver-core-testing, thanks!

    [ Narrow cp's scope to the newline handling block; use scoped_guard().
      - Danilo ]

      reply	other threads:[~2026-03-30 13:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25  9:09 [PATCH] driver core: simplify __device_set_driver_override() clearing logic Gui-Dong Han
2026-03-30 13:55 ` Danilo Krummrich [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=DHG627388EQG.3B3ZMSK2FQHUM@kernel.org \
    --to=dakr@kernel.org \
    --cc=akaieurus@qq.com \
    --cc=driver-core@lists.linux.dev \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hanguidong02@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /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