mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
usb: gadget: pch_udc: Initialize device pointer before use
[ Upstream commit971d080212] During conversion to use GPIO descriptors the device pointer, which is applied to devm_gpiod_get(), is not yet initialized. Move initialization in the ->probe() in order to have it set before use. Fixes:e20849a8c8("usb: gadget: pch_udc: Convert to use GPIO descriptors") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20210323153626.54908-6-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
3b67698060
commit
9f6e0fdb15
|
|
@ -1369,6 +1369,7 @@ static irqreturn_t pch_vbus_gpio_irq(int irq, void *data)
|
||||||
*/
|
*/
|
||||||
static int pch_vbus_gpio_init(struct pch_udc_dev *dev)
|
static int pch_vbus_gpio_init(struct pch_udc_dev *dev)
|
||||||
{
|
{
|
||||||
|
struct device *d = &dev->pdev->dev;
|
||||||
int err;
|
int err;
|
||||||
int irq_num = 0;
|
int irq_num = 0;
|
||||||
struct gpio_desc *gpiod;
|
struct gpio_desc *gpiod;
|
||||||
|
|
@ -1377,7 +1378,7 @@ static int pch_vbus_gpio_init(struct pch_udc_dev *dev)
|
||||||
dev->vbus_gpio.intr = 0;
|
dev->vbus_gpio.intr = 0;
|
||||||
|
|
||||||
/* Retrieve the GPIO line from the USB gadget device */
|
/* Retrieve the GPIO line from the USB gadget device */
|
||||||
gpiod = devm_gpiod_get(dev->gadget.dev.parent, NULL, GPIOD_IN);
|
gpiod = devm_gpiod_get(d, NULL, GPIOD_IN);
|
||||||
if (IS_ERR(gpiod))
|
if (IS_ERR(gpiod))
|
||||||
return PTR_ERR(gpiod);
|
return PTR_ERR(gpiod);
|
||||||
gpiod_set_consumer_name(gpiod, "pch_vbus");
|
gpiod_set_consumer_name(gpiod, "pch_vbus");
|
||||||
|
|
@ -3080,6 +3081,7 @@ static int pch_udc_probe(struct pci_dev *pdev,
|
||||||
if (retval)
|
if (retval)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
|
dev->pdev = pdev;
|
||||||
pci_set_drvdata(pdev, dev);
|
pci_set_drvdata(pdev, dev);
|
||||||
|
|
||||||
/* Determine BAR based on PCI ID */
|
/* Determine BAR based on PCI ID */
|
||||||
|
|
@ -3121,7 +3123,6 @@ static int pch_udc_probe(struct pci_dev *pdev,
|
||||||
|
|
||||||
/* device struct setup */
|
/* device struct setup */
|
||||||
spin_lock_init(&dev->lock);
|
spin_lock_init(&dev->lock);
|
||||||
dev->pdev = pdev;
|
|
||||||
dev->gadget.ops = &pch_udc_ops;
|
dev->gadget.ops = &pch_udc_ops;
|
||||||
|
|
||||||
retval = init_dma_pools(dev);
|
retval = init_dma_pools(dev);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user