Skip to content

Commit 5e761a2

Browse files
JoseExpositolumag
authored andcommitted
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: 5c82902 ("drm/msm/dsi: Split PHY drivers to separate files") Addresses-Coverity-ID: 1493860 ("Null pointer dereference") Signed-off-by: José Expósito <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent 860a7b2 commit 5e761a2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/msm/dsi/phy/dsi_phy.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,12 +808,14 @@ int msm_dsi_phy_enable(struct msm_dsi_phy *phy,
808808
struct msm_dsi_phy_clk_request *clk_req,
809809
struct msm_dsi_phy_shared_timings *shared_timings)
810810
{
811-
struct device *dev = &phy->pdev->dev;
811+
struct device *dev;
812812
int ret;
813813

814814
if (!phy || !phy->cfg->ops.enable)
815815
return -EINVAL;
816816

817+
dev = &phy->pdev->dev;
818+
817819
ret = dsi_phy_enable_resource(phy);
818820
if (ret) {
819821
DRM_DEV_ERROR(dev, "%s: resource enable failed, %d\n",

0 commit comments

Comments
 (0)