Re: [PATCH] PCI/sysfs: NULL res_attr slot after kfree as defence against double-remove

From: Krzysztof Wilczyński

Date: Thu May 21 2026 - 08:02:43 EST


> To me it looks more like pci_remove_resource_files() is expected to be
> entered only once.
>
> If this change is accepted, the 2nd entry is "silently" allowed whereas
> better course of action would feel to catch that in
> pci_remove_resource_files() with:
>
> if (WARN_ON_ONCE(something))
> return;
>
> That way, developers may become aware the code has some lifetime issue.
>
> (I'm not strictly against your change but I think it would be much better
> to have sane lifetimes and catch offenders.)

The upcoming sysfs changes would remove pci_remove_resource_files()
completely, so there would not be anything needed to be done here,
hopefully.

Thank you!

Krzysztof