Skip to content

Commit d27b1cd

Browse files
gregkhLorenzo Pieralisi
authored andcommitted
PCI: tegra: No need to check return value of debugfs_create() functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Link: https://lore.kernel.org/r/20200818133739.463193-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Thierry Reding <treding@nvidia.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Rob Herring <robh@kernel.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Jonathan Hunter <jonathanh@nvidia.com> Cc: Vidya Sagar <vidyas@nvidia.com> Cc: Andrew Murray <amurray@thegoodpenguin.co.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-pci@vger.kernel.org Cc: linux-tegra@vger.kernel.org Cc: linux-kernel@vger.kernel.org
1 parent 9123e3a commit d27b1cd

2 files changed

Lines changed: 10 additions & 35 deletions

File tree

‎drivers/pci/controller/dwc/pcie-tegra194.c‎

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -699,23 +699,16 @@ static void init_host_aspm(struct tegra_pcie_dw *pcie)
699699
dw_pcie_writel_dbi(pci, PORT_LOGIC_ACK_F_ASPM_CTRL, val);
700700
}
701701

702-
static int init_debugfs(struct tegra_pcie_dw *pcie)
702+
static void init_debugfs(struct tegra_pcie_dw *pcie)
703703
{
704-
struct dentry *d;
705-
706-
d = debugfs_create_devm_seqfile(pcie->dev, "aspm_state_cnt",
707-
pcie->debugfs, aspm_state_cnt);
708-
if (IS_ERR_OR_NULL(d))
709-
dev_err(pcie->dev,
710-
"Failed to create debugfs file \"aspm_state_cnt\"\n");
711-
712-
return 0;
704+
debugfs_create_devm_seqfile(pcie->dev, "aspm_state_cnt", pcie->debugfs,
705+
aspm_state_cnt);
713706
}
714707
#else
715708
static inline void disable_aspm_l12(struct tegra_pcie_dw *pcie) { return; }
716709
static inline void disable_aspm_l11(struct tegra_pcie_dw *pcie) { return; }
717710
static inline void init_host_aspm(struct tegra_pcie_dw *pcie) { return; }
718-
static inline int init_debugfs(struct tegra_pcie_dw *pcie) { return 0; }
711+
static inline void init_debugfs(struct tegra_pcie_dw *pcie) { return; }
719712
#endif
720713

721714
static void tegra_pcie_enable_system_interrupts(struct pcie_port *pp)
@@ -1641,10 +1634,7 @@ static int tegra_pcie_config_rp(struct tegra_pcie_dw *pcie)
16411634
}
16421635

16431636
pcie->debugfs = debugfs_create_dir(name, NULL);
1644-
if (!pcie->debugfs)
1645-
dev_err(dev, "Failed to create debugfs\n");
1646-
else
1647-
init_debugfs(pcie);
1637+
init_debugfs(pcie);
16481638

16491639
return ret;
16501640

‎drivers/pci/controller/pci-tegra.c‎

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2601,24 +2601,12 @@ static void tegra_pcie_debugfs_exit(struct tegra_pcie *pcie)
26012601
pcie->debugfs = NULL;
26022602
}
26032603

2604-
static int tegra_pcie_debugfs_init(struct tegra_pcie *pcie)
2604+
static void tegra_pcie_debugfs_init(struct tegra_pcie *pcie)
26052605
{
2606-
struct dentry *file;
2607-
26082606
pcie->debugfs = debugfs_create_dir("pcie", NULL);
2609-
if (!pcie->debugfs)
2610-
return -ENOMEM;
2611-
2612-
file = debugfs_create_file("ports", S_IFREG | S_IRUGO, pcie->debugfs,
2613-
pcie, &tegra_pcie_ports_ops);
2614-
if (!file)
2615-
goto remove;
2616-
2617-
return 0;
26182607

2619-
remove:
2620-
tegra_pcie_debugfs_exit(pcie);
2621-
return -ENOMEM;
2608+
debugfs_create_file("ports", S_IFREG | S_IRUGO, pcie->debugfs, pcie,
2609+
&tegra_pcie_ports_ops);
26222610
}
26232611

26242612
static int tegra_pcie_probe(struct platform_device *pdev)
@@ -2672,11 +2660,8 @@ static int tegra_pcie_probe(struct platform_device *pdev)
26722660
goto pm_runtime_put;
26732661
}
26742662

2675-
if (IS_ENABLED(CONFIG_DEBUG_FS)) {
2676-
err = tegra_pcie_debugfs_init(pcie);
2677-
if (err < 0)
2678-
dev_err(dev, "failed to setup debugfs: %d\n", err);
2679-
}
2663+
if (IS_ENABLED(CONFIG_DEBUG_FS))
2664+
tegra_pcie_debugfs_init(pcie);
26802665

26812666
return 0;
26822667

0 commit comments

Comments
 (0)