* [PATCH] phy: HiSilicon: Fix copy and paste bug in error handling
@ 2021-11-17 7:48 Dan Carpenter
2021-11-17 8:14 ` Mauro Carvalho Chehab
2021-11-23 5:12 ` Vinod Koul
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-11-17 7:48 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Mauro Carvalho Chehab
Cc: Vinod Koul, Manivannan Sadhasivam, linux-phy, kernel-janitors
This should check ">pmctrl" instead of "->sysctrl". This bug could
potentially lead to a crash if we dereference the error pointer.
Fixes: 73075011ffff ("phy: HiSilicon: Add driver for Kirin 970 PCIe PHY")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/phy/hisilicon/phy-hi3670-pcie.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/hisilicon/phy-hi3670-pcie.c b/drivers/phy/hisilicon/phy-hi3670-pcie.c
index c64c6679b1b9..0ac9634b398d 100644
--- a/drivers/phy/hisilicon/phy-hi3670-pcie.c
+++ b/drivers/phy/hisilicon/phy-hi3670-pcie.c
@@ -757,8 +757,8 @@ static int hi3670_pcie_phy_get_resources(struct hi3670_pcie_phy *phy,
return PTR_ERR(phy->sysctrl);
phy->pmctrl = syscon_regmap_lookup_by_compatible("hisilicon,hi3670-pmctrl");
- if (IS_ERR(phy->sysctrl))
- return PTR_ERR(phy->sysctrl);
+ if (IS_ERR(phy->pmctrl))
+ return PTR_ERR(phy->pmctrl);
/* clocks */
phy->phy_ref_clk = devm_clk_get(dev, "phy_ref");
--
2.20.1
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] phy: HiSilicon: Fix copy and paste bug in error handling
2021-11-17 7:48 [PATCH] phy: HiSilicon: Fix copy and paste bug in error handling Dan Carpenter
@ 2021-11-17 8:14 ` Mauro Carvalho Chehab
2021-11-23 5:12 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2021-11-17 8:14 UTC (permalink / raw)
To: Dan Carpenter
Cc: Kishon Vijay Abraham I, Vinod Koul, Manivannan Sadhasivam,
linux-phy, kernel-janitors
Em Wed, 17 Nov 2021 10:48:43 +0300
Dan Carpenter <dan.carpenter@oracle.com> escreveu:
> This should check ">pmctrl" instead of "->sysctrl". This bug could
> potentially lead to a crash if we dereference the error pointer.
>
> Fixes: 73075011ffff ("phy: HiSilicon: Add driver for Kirin 970 PCIe PHY")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> ---
> drivers/phy/hisilicon/phy-hi3670-pcie.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/phy/hisilicon/phy-hi3670-pcie.c b/drivers/phy/hisilicon/phy-hi3670-pcie.c
> index c64c6679b1b9..0ac9634b398d 100644
> --- a/drivers/phy/hisilicon/phy-hi3670-pcie.c
> +++ b/drivers/phy/hisilicon/phy-hi3670-pcie.c
> @@ -757,8 +757,8 @@ static int hi3670_pcie_phy_get_resources(struct hi3670_pcie_phy *phy,
> return PTR_ERR(phy->sysctrl);
>
> phy->pmctrl = syscon_regmap_lookup_by_compatible("hisilicon,hi3670-pmctrl");
> - if (IS_ERR(phy->sysctrl))
> - return PTR_ERR(phy->sysctrl);
> + if (IS_ERR(phy->pmctrl))
> + return PTR_ERR(phy->pmctrl);
>
> /* clocks */
> phy->phy_ref_clk = devm_clk_get(dev, "phy_ref");
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] phy: HiSilicon: Fix copy and paste bug in error handling
2021-11-17 7:48 [PATCH] phy: HiSilicon: Fix copy and paste bug in error handling Dan Carpenter
2021-11-17 8:14 ` Mauro Carvalho Chehab
@ 2021-11-23 5:12 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2021-11-23 5:12 UTC (permalink / raw)
To: Dan Carpenter
Cc: Kishon Vijay Abraham I, Mauro Carvalho Chehab,
Manivannan Sadhasivam, linux-phy, kernel-janitors
On 17-11-21, 10:48, Dan Carpenter wrote:
> This should check ">pmctrl" instead of "->sysctrl". This bug could
> potentially lead to a crash if we dereference the error pointer.
Applied, thanks
--
~Vinod
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-23 5:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-17 7:48 [PATCH] phy: HiSilicon: Fix copy and paste bug in error handling Dan Carpenter
2021-11-17 8:14 ` Mauro Carvalho Chehab
2021-11-23 5:12 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).