summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJosé Expósito <jose.exposito89@gmail.com>2022-01-16 19:18:44 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-01 17:27:08 +0100
commit56480fb10b976581a363fd168dc2e4fbee87a1a7 (patch)
treea295681132da122cee2c071db82aae8a3e3b7b2e /drivers
parent0069c2331be061668afb758f8dfc84dd160a57b8 (diff)
downloadlinux-stable-56480fb10b976581a363fd168dc2e4fbee87a1a7.tar.gz
linux-stable-56480fb10b976581a363fd168dc2e4fbee87a1a7.tar.bz2
linux-stable-56480fb10b976581a363fd168dc2e4fbee87a1a7.zip
drm/msm/dsi: invalid parameter check in msm_dsi_phy_enable
commit 5e761a2287234bc402ba7ef07129f5103bcd775c upstream. The function performs a check on the "phy" input parameter, however, it is used before the check. Initialize the "dev" variable after the sanity check to avoid a possible NULL pointer dereference. Fixes: 5c8290284402b ("drm/msm/dsi: Split PHY drivers to separate files") Addresses-Coverity-ID: 1493860 ("Null pointer dereference") Signed-off-by: José Expósito <jose.exposito89@gmail.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20220116181844.7400-1-jose.exposito89@gmail.com Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/msm/dsi/phy/dsi_phy.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index 8c65ef6968ca..a878b8b079c6 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -806,12 +806,14 @@ int msm_dsi_phy_enable(struct msm_dsi_phy *phy,
struct msm_dsi_phy_clk_request *clk_req,
struct msm_dsi_phy_shared_timings *shared_timings)
{
- struct device *dev = &phy->pdev->dev;
+ struct device *dev;
int ret;
if (!phy || !phy->cfg->ops.enable)
return -EINVAL;
+ dev = &phy->pdev->dev;
+
ret = dsi_phy_enable_resource(phy);
if (ret) {
DRM_DEV_ERROR(dev, "%s: resource enable failed, %d\n",