of_overlay_remove(9)
π 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:
struct target(9)struct fragment(9)struct overlay_changeset(9)of_overlay_notifier_register(9)of_overlay_notifier_unregister(9)add_changeset_property(9)add_changeset_node(9)build_changeset_next_level(9)changeset_dup_entry_check(9)build_changeset(9)init_overlay_changeset(9)of_overlay_fdt_apply(9)of_overlay_remove_all(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms