Re: [PATCH v5 1/6] PCI: spacemit-k1: Add device data support
From: Yao Zi
Date: Thu Sep 10 2026 - 01:48:06 EST
On Wed, Sep 09, 2026 at 04:00:33PM +0800, Inochi Amaoto wrote:
> On Tue, Sep 08, 2026 at 01:26:44PM +0300, Andy Shevchenko wrote:
> > On Mon, Sep 07, 2026 at 07:26:00PM +0800, Inochi Amaoto wrote:
> > > To reuse the K1 PCIe driver logic for K3 PCIe controller, add device
> > > data to handle the K1 specific logic and make room for the incoming
> > > logic for K3.
> >
> > ...
> >
> > > static int k1_pcie_probe(struct platform_device *pdev)
> > > {
> > > + const struct k1_pcie_device_data *data;
> > > struct device *dev = &pdev->dev;
> > > struct k1_pcie *k1;
> > > int ret;
> > >
> > > + data = device_get_match_data(dev);
> > > + if (!data)
> > > + return -ENODEV;
> >
> > It's better to use -ENODATA which will help to distinguish from other ENODEV
> > cases (which are more often to happen).
> >
>
> OK, thanks
Honestly, I don't think this should even happen, since every compatible
supported by the driver carries its own of_match_data, and failing to
do so is obviously a driver bug, so I think this branch could be
dropped.
> > > k1 = devm_kzalloc(dev, sizeof(*k1), GFP_KERNEL);
> > > if (!k1)
> > > return -ENOMEM;
> >
> > --
> > With Best Regards,
> > Andy Shevchenko
> >
> >
>
Best regards,
Yao Zi