aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoropeneuler-ci-bot <george@openeuler.sh>2024-04-10 03:11:39 +0000
committerGitee <noreply@gitee.com>2024-04-10 03:11:39 +0000
commitc6f749d59433c669c01000118cf059809dde4f38 (patch)
tree9651dfb6866352694fd83b29f7c0803f03121325
parentbe40e1002abbbdef576fd9192fa3d75372c7fda1 (diff)
parent402f51507eb030859841588fedc34b8a1612d28b (diff)
downloadopenEuler-kernel-c6f749d59433c669c01000118cf059809dde4f38.tar.gz
!5902 [sync] PR-4931: phy: ti: phy-omap-usb2: Fix NULL pointer dereference for SRP
Merge Pull Request from: @openeuler-sync-bot Origin pull request: https://gitee.com/openeuler/kernel/pulls/4931 PR sync from: Dong Chenchen <dongchenchen2@huawei.com> https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/JXNI5VT3RT75BCKAL4RBHJD4OQPZS3Z3/ https://gitee.com/src-openeuler/kernel/issues/I93HCX Link:https://gitee.com/openeuler/kernel/pulls/5902 Reviewed-by: Yue Haibing <yuehaibing@huawei.com> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
-rw-r--r--drivers/phy/ti/phy-omap-usb2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c
index f77ac041d83681..95e72f7a3199df 100644
--- a/drivers/phy/ti/phy-omap-usb2.c
+++ b/drivers/phy/ti/phy-omap-usb2.c
@@ -116,7 +116,7 @@ static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled)
{
struct omap_usb *phy = phy_to_omapusb(otg->usb_phy);
- if (!phy->comparator)
+ if (!phy->comparator || !phy->comparator->set_vbus)
return -ENODEV;
return phy->comparator->set_vbus(phy->comparator, enabled);
@@ -126,7 +126,7 @@ static int omap_usb_start_srp(struct usb_otg *otg)
{
struct omap_usb *phy = phy_to_omapusb(otg->usb_phy);
- if (!phy->comparator)
+ if (!phy->comparator || !phy->comparator->start_srp)
return -ENODEV;
return phy->comparator->start_srp(phy->comparator);