Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4594332pxj; Wed, 12 May 2021 08:53:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuEFCR3sNOKjulZmfUKnVtVmjLR5vwa+QpWvOtW9bz5fgFFgmbnk83yz8rKOGBYanH+toz X-Received: by 2002:a17:907:294f:: with SMTP id et15mr39021058ejc.324.1620834838326; Wed, 12 May 2021 08:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834838; cv=none; d=google.com; s=arc-20160816; b=F1xI0cigWZTiVKvkv/VRb0h6zI5OgtuXhqb7I234OX1U6gdeyS53GobndqtNmpAF7A xxz7pBJHovVYllv47B6hde4kLgNONhG4O7e754UZTaEFf1Ot+3FWZpTqUEJLFLUl+ZDa /9cLUCYgUT24waXsjAtSlCEVM6B5dara8Q36w0hGRpHvp/0/JyQEdxJtuKhNDhavZWJE EvA9BHOpyxeNUgXs5St0nyiWnrQZ7Sn9QkR6I+XW7tqB2Ba1lCcTUsHZmlxR50uXMfoP mMzjIROKiZl89ApiWeTsvQ8pQWQCkFJYmrnekY0dJMXk2Rsywn4vkdVhOvuQ4Zr1swcQ /odQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KtjScjKbqIhXkvCoi21q6GCdcAR/NnsFg0JTjAHdiKk=; b=g2KQzDejL6CsGXE8TqfX/zFkIX+QW82qWc70CHDgV2JhLlAjzoltKAqQegwzxVT6S7 yYSUxczj7E6DN1OoASSAUCuQXCc8YQBhSAJDvD+tZFIPuhZF2ZmiqC2WJQH9f1VkVMoW Kj5fgCfAF1W2uIxnDJtjKf6w6UQaIKVXR4MCCnvwcrBLJaMZuv3Byhbm18Ou2j3Ulkbr bakcWQhrsCUPVHFf+lOLjMXXing1Yq/5t4Ep+BZZ27CjMtFpEYTBFBtKqqvrX1kVdYhP 9thBCT0OC1kraNZpjkGvD7ggqANjGfOJC0lMBZ86qBHkyffx9ygqw+oxq+PDBigapVPC 9AkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pPf+eKPa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si312582eje.471.2021.05.12.08.53.34; Wed, 12 May 2021 08:53:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pPf+eKPa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237162AbhELPsi (ORCPT + 99 others); Wed, 12 May 2021 11:48:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:58726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233875AbhELPWk (ORCPT ); Wed, 12 May 2021 11:22:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A9369619B7; Wed, 12 May 2021 15:09:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832173; bh=d1IpXGukdJzawMYsXGhYceQVPe1rJOFaGMpvacD/6yk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pPf+eKPa9JWUF1byW+XmL/94mqNxhlmdQ4ipQ1a7eXib9rjOF1uu9nnLm+UirlIf+ 7xninmsPUbb8kuisg9lMFO7Nz3jKFDgRmqNR3fDl8Vv+MSlZyuOkE3+ryKbHHzLwjq SxDjxVN8O4iv5vVf+xabtaKGpcObUTTtYN1SdQjs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Sasha Levin Subject: [PATCH 5.10 171/530] usb: gadget: pch_udc: Initialize device pointer before use Date: Wed, 12 May 2021 16:44:41 +0200 Message-Id: <20210512144825.458066031@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko [ Upstream commit 971d080212be4ce2b91047d25a657f46d3e39635 ] 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: e20849a8c883 ("usb: gadget: pch_udc: Convert to use GPIO descriptors") Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20210323153626.54908-6-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/udc/pch_udc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c index 29e89ed6aad5..a39122f01cdb 100644 --- a/drivers/usb/gadget/udc/pch_udc.c +++ b/drivers/usb/gadget/udc/pch_udc.c @@ -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) { + struct device *d = &dev->pdev->dev; int err; int irq_num = 0; struct gpio_desc *gpiod; @@ -1377,7 +1378,7 @@ static int pch_vbus_gpio_init(struct pch_udc_dev *dev) dev->vbus_gpio.intr = 0; /* 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)) return PTR_ERR(gpiod); gpiod_set_consumer_name(gpiod, "pch_vbus"); @@ -3080,6 +3081,7 @@ static int pch_udc_probe(struct pci_dev *pdev, if (retval) return retval; + dev->pdev = pdev; pci_set_drvdata(pdev, dev); /* Determine BAR based on PCI ID */ @@ -3121,7 +3123,6 @@ static int pch_udc_probe(struct pci_dev *pdev, /* device struct setup */ spin_lock_init(&dev->lock); - dev->pdev = pdev; dev->gadget.ops = &pch_udc_ops; retval = init_dma_pools(dev); -- 2.30.2