[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200626172411.GE2571@kadam>
Date: Fri, 26 Jun 2020 20:24:11 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Pawel Laszczak <pawell@...ence.com>
Cc: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"balbi@...nel.org" <balbi@...nel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"ben.dooks@...ethink.co.uk" <ben.dooks@...ethink.co.uk>,
"colin.king@...onical.com" <colin.king@...onical.com>,
"rogerq@...com" <rogerq@...com>,
"peter.chen@....com" <peter.chen@....com>,
"weiyongjun1@...wei.com" <weiyongjun1@...wei.com>,
Jayshri Dajiram Pawar <jpawar@...ence.com>,
Rahul Kumar <kurahul@...ence.com>,
Sanket Parmar <sparmar@...ence.com>
Subject: Re: [PATCH RFC 2/5] usb:cdns3: Add pci to platform driver wrapper
On Fri, Jun 26, 2020 at 03:10:32PM +0000, Pawel Laszczak wrote:
> >> +static int cdnsp_pci_probe(struct pci_dev *pdev,
> >> + const struct pci_device_id *id)
> >> +{
> >> + struct platform_device_info plat_info;
> >> + struct cdnsp_wrap *wrap;
> >> + struct resource *res;
> >> + struct pci_dev *func;
> >> + int err;
> >> +
> >> + /*
> >> + * For GADGET/HOST PCI (devfn) function number is 0,
> >> + * for OTG PCI (devfn) function number is 1.
> >> + */
> >> + if (!id || (pdev->devfn != PCI_DEV_FN_HOST_DEVICE &&
> >> + pdev->devfn != PCI_DEV_FN_OTG))
> >> + return -EINVAL;
> >> +
> >> + func = cdnsp_get_second_fun(pdev);
> >> + if (unlikely(!func))
> >> + return -EINVAL;
> >> +
> >> + if (func->class == PCI_CLASS_SERIAL_USB_XHCI ||
> >> + pdev->class == PCI_CLASS_SERIAL_USB_XHCI)
> >> + return -EINVAL;
> >
> >
> >Do we need call pci_put_device(func) before returning?
>
> We don't need.
> Such function doesn't exist.
>
I meant pci_dev_put(). I'm pretty sure that we do need it to match the
pci_get_device() in cdnsp_get_second_fun().
regards,
dan carpenter
Powered by blists - more mailing lists