]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
soc/tegra: pmc: Remove reset sysfs entries on error
authorJon Hunter <jonathanh@nvidia.com>
Tue, 16 Apr 2019 16:48:07 +0000 (17:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Jun 2019 09:53:00 +0000 (11:53 +0200)
commitee3798fcf16dbdb2c221a405107050f422f6039e
tree726b8ee415a91360d6145c8d274fcb85bfe02646
parent47de03bebf1c89cfc4c65222bc25c4530b25949a
soc/tegra: pmc: Remove reset sysfs entries on error

[ Upstream commit a46b51cd2a57d52d5047e1d48240536243eeab34 ]

Commit 5f84bb1a4099 ("soc/tegra: pmc: Add sysfs entries for reset info")
added sysfs entries for Tegra reset source and level. However, these
sysfs are not removed on error and so if the registering of PMC device
is probe deferred, then the next time we attempt to probe the PMC device
warnings such as the following will be displayed on boot ...

  sysfs: cannot create duplicate filename '/devices/platform/7000e400.pmc/reset_reason'

Fix this by calling device_remove_file() for each sysfs entry added on
failure. Note that we call device_remove_file() unconditionally without
checking if the sysfs entry was created in the first place, but this
should be OK because kernfs_remove_by_name_ns() will fail silently.

Fixes: 5f84bb1a4099 ("soc/tegra: pmc: Add sysfs entries for reset info")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/soc/tegra/pmc.c