Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC

From: Fan Ni
Date: Mon Mar 03 2025 - 15:50:56 EST


On Tue, Mar 04, 2025 at 04:46:47AM +0900, Krzysztof Wilczyński wrote:
> Hello,
>
> [...]
> > > +int dwc_pcie_debugfs_init(struct dw_pcie *pci)
> > > +{
> > > + char dirname[DWC_DEBUGFS_BUF_MAX];
> > > + struct device *dev = pci->dev;
> > > + struct debugfs_info *debugfs;
> > > + struct dentry *dir;
> > > + int ret;
> > > +
> > > + /* Create main directory for each platform driver */
> > > + snprintf(dirname, DWC_DEBUGFS_BUF_MAX, "dwc_pcie_%s", dev_name(dev));
> > > + dir = debugfs_create_dir(dirname, NULL);
> > > + debugfs = devm_kzalloc(dev, sizeof(*debugfs), GFP_KERNEL);
> > > + if (!debugfs)
> > > + return -ENOMEM;
> > > +
> > > + debugfs->debug_dir = dir;
> > > + pci->debugfs = debugfs;
> > > + ret = dwc_pcie_rasdes_debugfs_init(pci, dir);
> > > + if (ret)
> > > + dev_dbg(dev, "RASDES debugfs init failed\n");
> >
> > What will happen if ret != 0? still return 0?
>
> Given that callers of dwc_pcie_debugfs_init() check for errors,
> this probably should correctly bubble up any failure coming from
> dwc_pcie_rasdes_debugfs_init().
>
> I made updates to the code directly on the current branch, have a look:
>
> https://web.git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/commit/?h=controller/dwc&id=1ff54f4cbaed9ec6994844967c36cf7ada4cbe5e
>
> Let me know if this is OK with you.

It looks good to me.

Feel free to add,
Reviewed-by: Fan Ni <fan.ni@xxxxxxxxxxx>

Fan
>
> Good catch, thank you!
>
> Krzysztof