Commit 5e761a22 authored by José Expósito's avatar José Expósito Committed by Dmitry Baryshkov

drm/msm/dsi: invalid parameter check in msm_dsi_phy_enable

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: 5c829028 ("drm/msm/dsi: Split PHY drivers to separate files")
Addresses-Coverity-ID: 1493860 ("Null pointer dereference")
Signed-off-by: default avatarJosé Expósito <jose.exposito89@gmail.com>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20220116181844.7400-1-jose.exposito89@gmail.comSigned-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
parent 860a7b2a
...@@ -808,12 +808,14 @@ int msm_dsi_phy_enable(struct msm_dsi_phy *phy, ...@@ -808,12 +808,14 @@ int msm_dsi_phy_enable(struct msm_dsi_phy *phy,
struct msm_dsi_phy_clk_request *clk_req, struct msm_dsi_phy_clk_request *clk_req,
struct msm_dsi_phy_shared_timings *shared_timings) struct msm_dsi_phy_shared_timings *shared_timings)
{ {
struct device *dev = &phy->pdev->dev; struct device *dev;
int ret; int ret;
if (!phy || !phy->cfg->ops.enable) if (!phy || !phy->cfg->ops.enable)
return -EINVAL; return -EINVAL;
dev = &phy->pdev->dev;
ret = dsi_phy_enable_resource(phy); ret = dsi_phy_enable_resource(phy);
if (ret) { if (ret) {
DRM_DEV_ERROR(dev, "%s: resource enable failed, %d\n", DRM_DEV_ERROR(dev, "%s: resource enable failed, %d\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment