提交 3195ac6d 编写于 作者: J Jon Hunter 提交者: Thierry Reding

soc/tegra: pmc: Remove debugfs entry on probe failure

The debugfs entry for the PMC device will not be removed if the probe of
the device fails to register the restart handler. This leaves behind the
dangling debugfs entry with no driver backing it. Remove the entry to
avoid this.
Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
Signed-off-by: NThierry Reding <treding@nvidia.com>
上级 1e52efdf
...@@ -117,6 +117,7 @@ struct tegra_pmc_soc { ...@@ -117,6 +117,7 @@ struct tegra_pmc_soc {
* @base: pointer to I/O remapped register region * @base: pointer to I/O remapped register region
* @clk: pointer to pclk clock * @clk: pointer to pclk clock
* @soc: pointer to SoC data structure * @soc: pointer to SoC data structure
* @debugfs: pointer to debugfs entry
* @rate: currently configured rate of pclk * @rate: currently configured rate of pclk
* @suspend_mode: lowest suspend mode available * @suspend_mode: lowest suspend mode available
* @cpu_good_time: CPU power good time (in microseconds) * @cpu_good_time: CPU power good time (in microseconds)
...@@ -136,6 +137,7 @@ struct tegra_pmc { ...@@ -136,6 +137,7 @@ struct tegra_pmc {
struct device *dev; struct device *dev;
void __iomem *base; void __iomem *base;
struct clk *clk; struct clk *clk;
struct dentry *debugfs;
const struct tegra_pmc_soc *soc; const struct tegra_pmc_soc *soc;
...@@ -447,11 +449,9 @@ static const struct file_operations powergate_fops = { ...@@ -447,11 +449,9 @@ static const struct file_operations powergate_fops = {
static int tegra_powergate_debugfs_init(void) static int tegra_powergate_debugfs_init(void)
{ {
struct dentry *d; pmc->debugfs = debugfs_create_file("powergate", S_IRUGO, NULL, NULL,
d = debugfs_create_file("powergate", S_IRUGO, NULL, NULL,
&powergate_fops); &powergate_fops);
if (!d) if (!pmc->debugfs)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
...@@ -844,6 +844,7 @@ static int tegra_pmc_probe(struct platform_device *pdev) ...@@ -844,6 +844,7 @@ static int tegra_pmc_probe(struct platform_device *pdev)
err = register_restart_handler(&tegra_pmc_restart_handler); err = register_restart_handler(&tegra_pmc_restart_handler);
if (err) { if (err) {
debugfs_remove(pmc->debugfs);
dev_err(&pdev->dev, "unable to register restart handler, %d\n", dev_err(&pdev->dev, "unable to register restart handler, %d\n",
err); err);
return err; return err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册