Re: [PATCH v2] of: overlay: remove unused of_overlay_remove_all()
From: Rob Herring (Arm)
Date: Thu Oct 15 2026 - 14:58:19 EST
On Wed, 14 Oct 2026 15:59:36 -0700, Abdurrahman Hussain wrote:
> of_overlay_remove_all() has no in-tree callers.
>
> It is also subtly broken. It passes &ovcs->id to of_overlay_remove(),
> which zeroes *ovcs_id once the changeset is reverted, before calling
> free_overlay_changeset(). Through the aliased pointer that zeroes
> ovcs->id itself, so free_overlay_changeset()'s "ovcs->id > 0" guard is
> false and both idr_remove() and list_del() are skipped: the
> overlay_changeset is kfree()d while still linked in ovcs_list and
> registered in ovcs_idr.
>
> Rather than fix a helper nobody calls, remove it, along with its
> !CONFIG_OF_OVERLAY stub and the paragraph documenting it in
> overlay-notes.rst and in the zh_CN translation.
>
> ovcs_list itself stays: overlay_removal_is_ok() still walks it to check
> that a changeset is topmost.
>
> Reported-by: Sashiko AI <sashiko-bot@xxxxxxxxxx>
> Closes: https://lore.kernel.org/20260901014554.83A8D1F000E9@xxxxxxxxxxxxxxx
> Suggested-by: Rob Herring <robh@xxxxxxxxxx>
> Link: https://lore.kernel.org/all/20260928182658.GA185307-robh@xxxxxxxxxx/
> Signed-off-by: Abdurrahman Hussain <abdurrahman@xxxxxxxxxx>
> ---
> Changes in v2:
> - Drop the one-liner fix and just remove of_overlay_remove_all(), as
> Rob suggested: it has no in-tree callers, so there is nothing to fix.
> - Also drop the !CONFIG_OF_OVERLAY stub and the paragraph documenting
> the function in overlay-notes.rst and in the zh_CN translation.
> - No longer tagged for stable: a removal is not a backport candidate.
> - Link to v1: https://patch.msgid.link/20260917-b4-of-overlay-remove-all-fix-v1-1-920441cecae2@xxxxxxxxxx
>
> To: Rob Herring <robh@xxxxxxxxxx>
> To: Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>
> To: Conor Dooley <conor+dt@xxxxxxxxxx>
> To: Alex Shi <alexs@xxxxxxxxxx>
> To: Yanteng Si <si.yanteng@xxxxxxxxx>
> To: Dongliang Mu <dzm91@xxxxxxxxxxx>
> To: Jonathan Corbet <corbet@xxxxxxx>
> To: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
> To: Saravana Kannan <saravanak@xxxxxxxxxx>
> Cc: devicetree@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Cc: linux-doc@xxxxxxxxxxxxxxx
> ---
> Documentation/devicetree/overlay-notes.rst | 4 ----
> .../zh_CN/devicetree/overlay-notes.rst | 3 ---
> drivers/of/overlay.c | 23 ----------------------
> include/linux/of.h | 6 ------
> 4 files changed, 36 deletions(-)
>
Applied, thanks!