[PATCH V7 2/6] mtd: partitions: remove sysfs files when deleting all master's partitions

Brian Norris computersforpeace at gmail.com
Thu Jun 22 14:05:33 PDT 2017


On Wed, Jun 21, 2017 at 08:26:43AM +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal at milecki.pl>
> 
> When support for sysfs "offset" file was added it missed to update the
> del_mtd_partitions function. It deletes partitions just like
> mtd_del_partition does so both should also take care of removing sysfs
> files.
> 
> This change moves sysfs_remove_files call to the shared function to fix
> this issue.
> 
> Fixes: a62c24d755291 ("mtd: part: Add sysfs variable for offset of partition")
> Cc: Dan Ehrenberg <dehrenberg at chromium.org>
> Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
> ---
> V7: Introduction of this patch, it was separated from the 1/6. It should
>     be clear now that this change is introduced. If something goes wrong
>     it should also be easier to revert it this way.

Thanks, splitting this out is nice actually. And thanks for looking up
the background on this oversight.

I'm not really sure what the actual effect of that omission would be;
the file won't be left dangling in sysfs (the device is removed
entirely), but I'm not sure if that'd trigger some kind of internal
kobject memory leak.

Anyway, looks good to me.

Side note: this patch series sort of massages the definition of this
"offset" file. Now, IIUC, subpartitions will have an "offset" file
relative to their parent partition, not the master flash device. I'm not
sure which way is expected.

Brian



More information about the linux-mtd mailing list