提交 2a4ea83b 编写于 作者: J Jon Hunter 提交者: Vinod Koul

phy: tegra: xusb: Fix crash during pad power on/down

Commit a88520bf ("usb: gadget: tegra: Reduce pad power") added calls
to tegra_phy_xusb_utmi_pad_power_on/down in the Tegra XUDC driver to
control the pad power. This change is causing a kernel panic when
powering down the pads on entering suspend with the Jetson TX2 platform.
The panic occurs because the 'xudc->curr_utmi_phy' is not configured on
this platform and we do not check to see if the pointer is valid before
attempting to deference the pointer. Fix this by checking to see if the
'phy' pointer passed to tegra_phy_xusb_utmi_pad_power_on/down is valid.

Fixes: a88520bf ("usb: gadget: tegra: Reduce pad power")
Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20221010135132.30809-1-jonathanh@nvidia.comSigned-off-by: NVinod Koul <vkoul@kernel.org>
上级 ca1c7362
...@@ -1461,8 +1461,14 @@ EXPORT_SYMBOL_GPL(tegra_phy_xusb_utmi_port_reset); ...@@ -1461,8 +1461,14 @@ EXPORT_SYMBOL_GPL(tegra_phy_xusb_utmi_port_reset);
void tegra_phy_xusb_utmi_pad_power_on(struct phy *phy) void tegra_phy_xusb_utmi_pad_power_on(struct phy *phy)
{ {
struct tegra_xusb_lane *lane = phy_get_drvdata(phy); struct tegra_xusb_lane *lane;
struct tegra_xusb_padctl *padctl = lane->pad->padctl; struct tegra_xusb_padctl *padctl;
if (!phy)
return;
lane = phy_get_drvdata(phy);
padctl = lane->pad->padctl;
if (padctl->soc->ops->utmi_pad_power_on) if (padctl->soc->ops->utmi_pad_power_on)
padctl->soc->ops->utmi_pad_power_on(phy); padctl->soc->ops->utmi_pad_power_on(phy);
...@@ -1471,8 +1477,14 @@ EXPORT_SYMBOL_GPL(tegra_phy_xusb_utmi_pad_power_on); ...@@ -1471,8 +1477,14 @@ EXPORT_SYMBOL_GPL(tegra_phy_xusb_utmi_pad_power_on);
void tegra_phy_xusb_utmi_pad_power_down(struct phy *phy) void tegra_phy_xusb_utmi_pad_power_down(struct phy *phy)
{ {
struct tegra_xusb_lane *lane = phy_get_drvdata(phy); struct tegra_xusb_lane *lane;
struct tegra_xusb_padctl *padctl = lane->pad->padctl; struct tegra_xusb_padctl *padctl;
if (!phy)
return;
lane = phy_get_drvdata(phy);
padctl = lane->pad->padctl;
if (padctl->soc->ops->utmi_pad_power_down) if (padctl->soc->ops->utmi_pad_power_down)
padctl->soc->ops->utmi_pad_power_down(phy); padctl->soc->ops->utmi_pad_power_down(phy);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册