* [PATCH 1/3] PCI: qcom: Fix missing error code in qcom_pcie_probe() [not found] <20240708180539.1447307-1-dan.carpenter@linaro.org> @ 2024-07-08 18:05 ` Dan Carpenter 2024-07-09 5:11 ` Manivannan Sadhasivam 2024-07-08 18:05 ` [PATCH 2/3] PCI: qcom: Prevent potential error pointer dereference Dan Carpenter 2024-07-08 18:05 ` [PATCH 3/3] PCI: qcom: Potential uninitialized variable in qcom_pcie_suspend_noirq() Dan Carpenter 2 siblings, 1 reply; 8+ messages in thread From: Dan Carpenter @ 2024-07-08 18:05 UTC (permalink / raw) To: Krishna chaitanya chundru Cc: Dan Carpenter, Manivannan Sadhasivam, Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas, linux-arm-msm, linux-pci, linux-kernel Return a negative error code if dev_pm_opp_find_freq_floor() fails. Don't return success. Fixes: 78b5f6f8855e ("PCI: qcom: Add OPP support to scale performance") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> --- drivers/pci/controller/dwc/pcie-qcom.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 26405fcfa499..1d36311f9adb 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1574,7 +1574,8 @@ static int qcom_pcie_probe(struct platform_device *pdev) if (!ret) { opp = dev_pm_opp_find_freq_floor(dev, &max_freq); if (IS_ERR(opp)) { - dev_err_probe(pci->dev, PTR_ERR(opp), + ret = PTR_ERR(opp); + dev_err_probe(pci->dev, ret, "Unable to find max freq OPP\n"); goto err_pm_runtime_put; } else { -- 2.43.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] PCI: qcom: Fix missing error code in qcom_pcie_probe() 2024-07-08 18:05 ` [PATCH 1/3] PCI: qcom: Fix missing error code in qcom_pcie_probe() Dan Carpenter @ 2024-07-09 5:11 ` Manivannan Sadhasivam 0 siblings, 0 replies; 8+ messages in thread From: Manivannan Sadhasivam @ 2024-07-09 5:11 UTC (permalink / raw) To: Dan Carpenter Cc: Krishna chaitanya chundru, Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas, linux-arm-msm, linux-pci, linux-kernel On Mon, Jul 08, 2024 at 01:05:36PM -0500, Dan Carpenter wrote: > Return a negative error code if dev_pm_opp_find_freq_floor() fails. > Don't return success. > > Fixes: 78b5f6f8855e ("PCI: qcom: Add OPP support to scale performance") > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> - Mani > --- > drivers/pci/controller/dwc/pcie-qcom.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > index 26405fcfa499..1d36311f9adb 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom.c > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > @@ -1574,7 +1574,8 @@ static int qcom_pcie_probe(struct platform_device *pdev) > if (!ret) { > opp = dev_pm_opp_find_freq_floor(dev, &max_freq); > if (IS_ERR(opp)) { > - dev_err_probe(pci->dev, PTR_ERR(opp), > + ret = PTR_ERR(opp); > + dev_err_probe(pci->dev, ret, > "Unable to find max freq OPP\n"); > goto err_pm_runtime_put; > } else { > -- > 2.43.0 > -- மணிவண்ணன் சதாசிவம் ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] PCI: qcom: Prevent potential error pointer dereference [not found] <20240708180539.1447307-1-dan.carpenter@linaro.org> 2024-07-08 18:05 ` [PATCH 1/3] PCI: qcom: Fix missing error code in qcom_pcie_probe() Dan Carpenter @ 2024-07-08 18:05 ` Dan Carpenter 2024-07-09 5:14 ` Manivannan Sadhasivam ` (2 more replies) 2024-07-08 18:05 ` [PATCH 3/3] PCI: qcom: Potential uninitialized variable in qcom_pcie_suspend_noirq() Dan Carpenter 2 siblings, 3 replies; 8+ messages in thread From: Dan Carpenter @ 2024-07-08 18:05 UTC (permalink / raw) To: Krishna chaitanya chundru Cc: Dan Carpenter, Manivannan Sadhasivam, Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas, linux-arm-msm, linux-pci, linux-kernel Only call dev_pm_opp_put() if dev_pm_opp_find_freq_exact() succeeds. Otherwise it leads to an error pointer dereference. Fixes: 78b5f6f8855e ("PCI: qcom: Add OPP support to scale performance") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> --- drivers/pci/controller/dwc/pcie-qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 1d36311f9adb..e06c4ad3a72a 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1443,8 +1443,8 @@ static void qcom_pcie_icc_opp_update(struct qcom_pcie *pcie) if (ret) dev_err(pci->dev, "Failed to set OPP for freq (%lu): %d\n", freq_kbps * width, ret); + dev_pm_opp_put(opp); } - dev_pm_opp_put(opp); } } -- 2.43.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] PCI: qcom: Prevent potential error pointer dereference 2024-07-08 18:05 ` [PATCH 2/3] PCI: qcom: Prevent potential error pointer dereference Dan Carpenter @ 2024-07-09 5:14 ` Manivannan Sadhasivam 2024-07-09 13:59 ` Anders Roxell 2024-07-10 5:43 ` Krzysztof Wilczyński 2 siblings, 0 replies; 8+ messages in thread From: Manivannan Sadhasivam @ 2024-07-09 5:14 UTC (permalink / raw) To: Dan Carpenter Cc: Krishna chaitanya chundru, Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas, linux-arm-msm, linux-pci, linux-kernel On Mon, Jul 08, 2024 at 01:05:37PM -0500, Dan Carpenter wrote: > Only call dev_pm_opp_put() if dev_pm_opp_find_freq_exact() succeeds. > Otherwise it leads to an error pointer dereference. > > Fixes: 78b5f6f8855e ("PCI: qcom: Add OPP support to scale performance") > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> - Mani > --- > drivers/pci/controller/dwc/pcie-qcom.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > index 1d36311f9adb..e06c4ad3a72a 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom.c > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > @@ -1443,8 +1443,8 @@ static void qcom_pcie_icc_opp_update(struct qcom_pcie *pcie) > if (ret) > dev_err(pci->dev, "Failed to set OPP for freq (%lu): %d\n", > freq_kbps * width, ret); > + dev_pm_opp_put(opp); > } > - dev_pm_opp_put(opp); > } > } > > -- > 2.43.0 > -- மணிவண்ணன் சதாசிவம் ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] PCI: qcom: Prevent potential error pointer dereference 2024-07-08 18:05 ` [PATCH 2/3] PCI: qcom: Prevent potential error pointer dereference Dan Carpenter 2024-07-09 5:14 ` Manivannan Sadhasivam @ 2024-07-09 13:59 ` Anders Roxell 2024-07-10 5:43 ` Krzysztof Wilczyński 2 siblings, 0 replies; 8+ messages in thread From: Anders Roxell @ 2024-07-09 13:59 UTC (permalink / raw) To: dan.carpenter, Krishna chaitanya chundru Cc: bhelgaas, kw, linux-arm-msm, linux-kernel, linux-pci, lpieralisi, manivannan.sadhasivam, robh, Anders Roxell From: Dan Carpenter <dan.carpenter@linaro.org> > Only call dev_pm_opp_put() if dev_pm_opp_find_freq_exact() succeeds. > Otherwise it leads to an error pointer dereference. > > Fixes: 78b5f6f8855e ("PCI: qcom: Add OPP support to scale performance") > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Tested-by: Anders Roxell <anders.roxell@linaro.org> Applied this patch ontop of linux-next tag, next-20240709. Booted fine on dragonboard-845c HW. Cheers, Anders > --- > drivers/pci/controller/dwc/pcie-qcom.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > index 1d36311f9adb..e06c4ad3a72a 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom.c > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > @@ -1443,8 +1443,8 @@ static void qcom_pcie_icc_opp_update(struct qcom_pcie *pcie) > if (ret) > dev_err(pci->dev, "Failed to set OPP for freq (%lu): %d\n", > freq_kbps * width, ret); > + dev_pm_opp_put(opp); > } > - dev_pm_opp_put(opp); > } > } > > -- > 2.43.0 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] PCI: qcom: Prevent potential error pointer dereference 2024-07-08 18:05 ` [PATCH 2/3] PCI: qcom: Prevent potential error pointer dereference Dan Carpenter 2024-07-09 5:14 ` Manivannan Sadhasivam 2024-07-09 13:59 ` Anders Roxell @ 2024-07-10 5:43 ` Krzysztof Wilczyński 2 siblings, 0 replies; 8+ messages in thread From: Krzysztof Wilczyński @ 2024-07-10 5:43 UTC (permalink / raw) To: Anders Roxell Cc: dan.carpenter, Krishna chaitanya chundru, bhelgaas, linux-arm-msm, linux-kernel, linux-pci, lpieralisi, manivannan.sadhasivam, robh Hello, [...] > > Only call dev_pm_opp_put() if dev_pm_opp_find_freq_exact() succeeds. > > Otherwise it leads to an error pointer dereference. > > > > Fixes: 78b5f6f8855e ("PCI: qcom: Add OPP support to scale performance") > > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> > > Tested-by: Anders Roxell <anders.roxell@linaro.org> > > Applied this patch ontop of linux-next tag, next-20240709. > > Booted fine on dragonboard-845c HW. Thank you for testing! I took the liberty and added your Tested-by: tag to the relevant commits on our controller/qcom branch. Krzysztof ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] PCI: qcom: Potential uninitialized variable in qcom_pcie_suspend_noirq() [not found] <20240708180539.1447307-1-dan.carpenter@linaro.org> 2024-07-08 18:05 ` [PATCH 1/3] PCI: qcom: Fix missing error code in qcom_pcie_probe() Dan Carpenter 2024-07-08 18:05 ` [PATCH 2/3] PCI: qcom: Prevent potential error pointer dereference Dan Carpenter @ 2024-07-08 18:05 ` Dan Carpenter 2024-07-09 5:15 ` Manivannan Sadhasivam 2 siblings, 1 reply; 8+ messages in thread From: Dan Carpenter @ 2024-07-08 18:05 UTC (permalink / raw) To: Krishna chaitanya chundru Cc: Dan Carpenter, Manivannan Sadhasivam, Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas, linux-pci, linux-arm-msm, linux-kernel Smatch complains that "ret" could be uninitialized if "pcie->icc_mem" is NULL and "pm_suspend_target_state == PM_SUSPEND_MEM". Silence this warning by initializing ret to zero. Fixes: 78b5f6f8855e ("PCI: qcom: Add OPP support to scale performance") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> --- drivers/pci/controller/dwc/pcie-qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index e06c4ad3a72a..74e2acf4ae11 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1633,7 +1633,7 @@ static int qcom_pcie_probe(struct platform_device *pdev) static int qcom_pcie_suspend_noirq(struct device *dev) { struct qcom_pcie *pcie = dev_get_drvdata(dev); - int ret; + int ret = 0; /* * Set minimum bandwidth required to keep data path functional during -- 2.43.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] PCI: qcom: Potential uninitialized variable in qcom_pcie_suspend_noirq() 2024-07-08 18:05 ` [PATCH 3/3] PCI: qcom: Potential uninitialized variable in qcom_pcie_suspend_noirq() Dan Carpenter @ 2024-07-09 5:15 ` Manivannan Sadhasivam 0 siblings, 0 replies; 8+ messages in thread From: Manivannan Sadhasivam @ 2024-07-09 5:15 UTC (permalink / raw) To: Dan Carpenter Cc: Krishna chaitanya chundru, Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas, linux-pci, linux-arm-msm, linux-kernel On Mon, Jul 08, 2024 at 01:05:38PM -0500, Dan Carpenter wrote: > Smatch complains that "ret" could be uninitialized if "pcie->icc_mem" > is NULL and "pm_suspend_target_state == PM_SUSPEND_MEM". Silence this > warning by initializing ret to zero. > > Fixes: 78b5f6f8855e ("PCI: qcom: Add OPP support to scale performance") > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> - Mani > --- > drivers/pci/controller/dwc/pcie-qcom.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > index e06c4ad3a72a..74e2acf4ae11 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom.c > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > @@ -1633,7 +1633,7 @@ static int qcom_pcie_probe(struct platform_device *pdev) > static int qcom_pcie_suspend_noirq(struct device *dev) > { > struct qcom_pcie *pcie = dev_get_drvdata(dev); > - int ret; > + int ret = 0; > > /* > * Set minimum bandwidth required to keep data path functional during > -- > 2.43.0 > -- மணிவண்ணன் சதாசிவம் ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-07-10 5:43 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20240708180539.1447307-1-dan.carpenter@linaro.org>
2024-07-08 18:05 ` [PATCH 1/3] PCI: qcom: Fix missing error code in qcom_pcie_probe() Dan Carpenter
2024-07-09 5:11 ` Manivannan Sadhasivam
2024-07-08 18:05 ` [PATCH 2/3] PCI: qcom: Prevent potential error pointer dereference Dan Carpenter
2024-07-09 5:14 ` Manivannan Sadhasivam
2024-07-09 13:59 ` Anders Roxell
2024-07-10 5:43 ` Krzysztof Wilczyński
2024-07-08 18:05 ` [PATCH 3/3] PCI: qcom: Potential uninitialized variable in qcom_pcie_suspend_noirq() Dan Carpenter
2024-07-09 5:15 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox