]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
phy: qcom-qmp-combo: fix NULL-deref on runtime resume
authorJohan Hovold <johan+linaro@kernel.org>
Wed, 26 Oct 2022 16:21:16 +0000 (18:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Nov 2022 09:04:09 +0000 (10:04 +0100)
commit 04948e757148f870a31f4887ea2239403f516c3c upstream.

Commit fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate
PCS_USB region") started treating the PCS_USB registers as potentially
separate from the PCS registers but used the wrong base when no PCS_USB
offset has been provided.

Fix the PCS_USB base used at runtime resume to prevent dereferencing a
NULL pointer on platforms that do not provide a PCS_USB offset (e.g.
SC7180).

Fixes: fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region")
Cc: stable@vger.kernel.org # 5.20
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Link: https://lore.kernel.org/r/20221026162116.26462-1-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/phy/qualcomm/phy-qcom-qmp-combo.c

index 4b182897610446ef3adaa619c538e14f06c7c13f..3e730c05ac3fb1cec980660bb04818507d0bfb3f 100644 (file)
@@ -1914,7 +1914,7 @@ static void qcom_qmp_phy_combo_enable_autonomous_mode(struct qmp_phy *qphy)
 static void qcom_qmp_phy_combo_disable_autonomous_mode(struct qmp_phy *qphy)
 {
        const struct qmp_phy_cfg *cfg = qphy->cfg;
-       void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs_usb;
+       void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs;
        void __iomem *pcs_misc = qphy->pcs_misc;
 
        /* Disable i/o clamp_n on resume for normal mode */