]> asedeno.scripts.mit.edu Git - linux.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)
committerThierry Reding <treding@nvidia.com>
Wed, 17 Apr 2019 08:32:08 +0000 (10:32 +0200)
commita46b51cd2a57d52d5047e1d48240536243eeab34
tree2981bd579cea837ccd30aa8544880573b3cbeaa0
parent00cdaa1b811f36afa52a5956350c263ded4944a6
soc/tegra: pmc: Remove reset sysfs entries on error

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>
drivers/soc/tegra/pmc.c