of_overlay_remove(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… of_overlay_remove(9) β€” the "undo my overlay, bestie" era

okay so real talk, this is of_overlay_remove(9) from the Kernel API Manual, and it's about to be your new favorite little guy for when you need to undo an overlay changeset and free it. periodt.


✨ NAME ✨

of_overlay_remove β€” revert and free an overlay changeset πŸŽ€


🌸 SYNOPSIS 🌸

int of_overlay_remove (int *ovcs_id );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • ovcs_id β€” pointer to the overlay changeset id. yes it's a pointer, yes you need it, no you cannot skip it πŸ’…

πŸ‘‘ DESCRIPTION πŸ‘‘

So here's the vibe: this function removes an overlay if it is permissible. and ovcs_id? that was previously handed to you by of_overlay_fdt_apply, so like, don't just make one up bestie πŸ™ˆ

Now the messy part, and ngl you need to hear it:

If an error occurred while attempting to revert the overlay changeset, then an attempt is made to re-apply any changeset entry that was reverted. and if an error occurs on re-apply then the state of the device tree can not be determined, and any following attempt to apply or remove an overlay changeset will be refused. πŸ’€ that's the "we don't know what's going on anymore" arc. highkey scary.

A non-zero return value will not revert the changeset if the error is from:

  • parameter checks
  • overlay changeset pre-remove notifier
  • overlay changeset entry revert

If an error is returned by an overlay changeset pre-remove notifier then no further overlay changeset pre-remove notifier will be called. like, the chain just stops. 🫢

If more than one notifier returns an error, then the last notifier error to occur is returned. iykyk.

A non-zero return value will revert the changeset if the error is from:

  • overlay changeset entry notifier
  • overlay changeset post-remove notifier

If an error is returned by an overlay changeset post-remove notifier then no further overlay changeset post-remove notifier will be called. same energy, different notifier. ✨


⭐ RETURN ⭐

0 on success, or a negative error number. and here's the iconic bit: *ovcs_id is set to zero after reverting the changeset, even if a subsequent error occurs. she cleans up after herself no matter what πŸ˜­πŸ’–


🌈 SEE ALSO 🌈

Kernel file ./drivers/of/overlay.c, plus the whole friend group:


and that's the whole page, bestie 🧚 this one lives in ./drivers/of and it's dated October 2026 β€” go forth and revert responsibly πŸ’œβœ¨

πŸ“¦ where this page comes from