Commit Message
Greg KH
Oct. 19, 2022, 8:30 a.m. UTC
From: Johan Hovold <johan+linaro@kernel.org> [ Upstream commit ecd5507e72ea03659dc2cc3e4393fbf8f4e2e02a ] Make sure that the (otherwise) optional pcs_misc IO region has been provided in case the configuration specifies a corresponding initialisation table to avoid crashing with malformed device trees. Note that the related debug message is now superfluous as the region is only used when the configuration has a pcs_misc table. Fixes: 421c9a0e9731 ("phy: qcom: qmp: Add SDM845 PCIe QMP PHY support") Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://lore.kernel.org/r/20220916102340.11520-2-johan+linaro@kernel.org Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Comments
On Wed, Oct 19, 2022 at 10:30:10AM +0200, Greg Kroah-Hartman wrote: > From: Johan Hovold <johan+linaro@kernel.org> > > [ Upstream commit ecd5507e72ea03659dc2cc3e4393fbf8f4e2e02a ] > > Make sure that the (otherwise) optional pcs_misc IO region has been > provided in case the configuration specifies a corresponding > initialisation table to avoid crashing with malformed device trees. > > Note that the related debug message is now superfluous as the region is > only used when the configuration has a pcs_misc table. > > Fixes: 421c9a0e9731 ("phy: qcom: qmp: Add SDM845 PCIe QMP PHY support") > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > Link: https://lore.kernel.org/r/20220916102340.11520-2-johan+linaro@kernel.org > Signed-off-by: Vinod Koul <vkoul@kernel.org> > Signed-off-by: Sasha Levin <sashal@kernel.org> This was added to prevent future bugs when adding support for new platforms and did not have a stable tag. Please drop. > --- > drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > index 2d65e1f56bfc..0e0f2482827a 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > @@ -2371,8 +2371,10 @@ int qcom_qmp_phy_pcie_create(struct device *dev, struct device_node *np, int id, > of_device_is_compatible(dev->of_node, "qcom,ipq6018-qmp-pcie-phy")) > qphy->pcs_misc = qphy->pcs + 0x400; > > - if (!qphy->pcs_misc) > - dev_vdbg(dev, "PHY pcs_misc-reg not used\n"); > + if (!qphy->pcs_misc) { > + if (cfg->pcs_misc_tbl || cfg->pcs_misc_tbl_sec) > + return -EINVAL; > + } > > snprintf(prop_name, sizeof(prop_name), "pipe%d", id); > qphy->pipe_clk = devm_get_clk_from_child(dev, np, prop_name); Johan
On Wed, Oct 19, 2022 at 11:15:31AM +0200, Johan Hovold wrote: > On Wed, Oct 19, 2022 at 10:30:10AM +0200, Greg Kroah-Hartman wrote: > > From: Johan Hovold <johan+linaro@kernel.org> > > > > [ Upstream commit ecd5507e72ea03659dc2cc3e4393fbf8f4e2e02a ] > > > > Make sure that the (otherwise) optional pcs_misc IO region has been > > provided in case the configuration specifies a corresponding > > initialisation table to avoid crashing with malformed device trees. > > > > Note that the related debug message is now superfluous as the region is > > only used when the configuration has a pcs_misc table. > > > > Fixes: 421c9a0e9731 ("phy: qcom: qmp: Add SDM845 PCIe QMP PHY support") > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > > Link: https://lore.kernel.org/r/20220916102340.11520-2-johan+linaro@kernel.org > > Signed-off-by: Vinod Koul <vkoul@kernel.org> > > Signed-off-by: Sasha Levin <sashal@kernel.org> > > This was added to prevent future bugs when adding support for new > platforms and did not have a stable tag. Please drop. Ok, that wasn't obvious at all from the changelog :( I'll go drop this, and the others you marked as "should not be there" from the queue, thanks. Maybe next time, don't use a Fixes: tag if the commit really doesn't "fix" anything in the current kernel... thanks, greg k-h
On Wed, Oct 19, 2022 at 12:41:31PM +0200, Greg Kroah-Hartman wrote: > On Wed, Oct 19, 2022 at 11:15:31AM +0200, Johan Hovold wrote: > > On Wed, Oct 19, 2022 at 10:30:10AM +0200, Greg Kroah-Hartman wrote: > > > From: Johan Hovold <johan+linaro@kernel.org> > > > > > > [ Upstream commit ecd5507e72ea03659dc2cc3e4393fbf8f4e2e02a ] > > > > > > Make sure that the (otherwise) optional pcs_misc IO region has been > > > provided in case the configuration specifies a corresponding > > > initialisation table to avoid crashing with malformed device trees. > > > > > > Note that the related debug message is now superfluous as the region is > > > only used when the configuration has a pcs_misc table. > > > > > > Fixes: 421c9a0e9731 ("phy: qcom: qmp: Add SDM845 PCIe QMP PHY support") > > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > > > Link: https://lore.kernel.org/r/20220916102340.11520-2-johan+linaro@kernel.org > > > Signed-off-by: Vinod Koul <vkoul@kernel.org> > > > Signed-off-by: Sasha Levin <sashal@kernel.org> > > > > This was added to prevent future bugs when adding support for new > > platforms and did not have a stable tag. Please drop. > > Ok, that wasn't obvious at all from the changelog :( Ah, sorry, I misread my own patch. This one does indeed prevent a crash with malformed devicetrees as the commit message says. But whether that needs backporting or nor is a separate question. I'd say either way is fine. > I'll go drop this, and the others you marked as "should not be there" > from the queue, thanks. Thanks. > Maybe next time, don't use a Fixes: tag if the commit really doesn't > "fix" anything in the current kernel... Sorry about the confusion. The Fixes tag is correct in this case. Johan
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c index 2d65e1f56bfc..0e0f2482827a 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c @@ -2371,8 +2371,10 @@ int qcom_qmp_phy_pcie_create(struct device *dev, struct device_node *np, int id, of_device_is_compatible(dev->of_node, "qcom,ipq6018-qmp-pcie-phy")) qphy->pcs_misc = qphy->pcs + 0x400; - if (!qphy->pcs_misc) - dev_vdbg(dev, "PHY pcs_misc-reg not used\n"); + if (!qphy->pcs_misc) { + if (cfg->pcs_misc_tbl || cfg->pcs_misc_tbl_sec) + return -EINVAL; + } snprintf(prop_name, sizeof(prop_name), "pipe%d", id); qphy->pipe_clk = devm_get_clk_from_child(dev, np, prop_name);