[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f5571caf-9a17-3b03-14fa-dc988b10747a@gmail.com>
Date: Wed, 16 Dec 2020 12:22:22 +0300
From: Dmitry Osipenko <digetx@...il.com>
To: Peter Chen <peter.chen@....com>
Cc: Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alan Stern <stern@...land.harvard.edu>,
Felipe Balbi <balbi@...nel.org>,
Matt Merhar <mattmerhar@...tonmail.com>,
Nicolas Chauvet <kwizart@...il.com>,
Peter Geis <pgwipeout@...il.com>,
"linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1 5/8] usb: chipidea: tegra: Support host mode
16.12.2020 12:07, Dmitry Osipenko пишет:
>>> static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable)
>>> {
>>> struct ehci_hcd *ehci = hcd_to_ehci(hcd);
>>> @@ -160,14 +166,14 @@ static int host_start(struct ci_hdrc *ci)
>>> pinctrl_select_state(ci->platdata->pctl,
>>> ci->platdata->pins_host);
>>>
>>> + ci->hcd = hcd;
>>> +
>>> ret = usb_add_hcd(hcd, 0, 0);
>>> if (ret) {
>>> goto disable_reg;
>>> } else {
>>> struct usb_otg *otg = &ci->otg;
>>>
>>> - ci->hcd = hcd;
>>> -
>> Why this changed?
> The ci->hcd is used by tegra_usb_notify_event() to handle reset event
> and the reset happens once usb_add_hcd() is invoked. Hence we need to
> pre-assign the hcd pointer, otherwise there will be a NULL dereference.
Actually, not a NULL dereference, but the reset will be skipped since we
check whether ci->hcd is NULL in the tegra's reset handler.
Powered by blists - more mailing lists