diff options
| author | Gui-Dong Han <hanguidong02@gmail.com> | 2026-03-25 17:09:05 +0800 |
|---|---|---|
| committer | Danilo Krummrich <dakr@kernel.org> | 2026-03-30 14:45:51 +0200 |
| commit | 3210dabba4e4aff7395b68914bad95153dda6db7 (patch) | |
| tree | cfe2fdc39ae1736cde2ceda16b8d3acb237ffb1b /Documentation/controllers/git@git.tavy.me:linux.git | |
| parent | a1fa010b3c9f0adae252986ddb54a449df45f700 (diff) | |
driver core: simplify __device_set_driver_override() clearing logic
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>
Link: https://patch.msgid.link/20260325090905.169000-1-hanguidong02@gmail.com
[ Narrow cp's scope to the newline handling block; use scoped_guard().
- Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'Documentation/controllers/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
