Skip to content

Commit 91a3407

Browse files
Colin Ian Kinggregkh
Colin Ian King
authored andcommitted
drm/msm: Fix null pointer dereference on pointer edp
commit 2133c4f upstream. The initialization of pointer dev dereferences pointer edp before edp is null checked, so there is a potential null pointer deference issue. Fix this by only dereferencing edp after edp has been null checked. Addresses-Coverity: ("Dereference before null check") Fixes: ab5b010 ("drm/msm: Initial add eDP support in msm drm driver (v5)") Signed-off-by: Colin Ian King <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Clark <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a7b4502 commit 91a3407

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/msm/edp/edp_ctrl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,14 +1116,15 @@ void msm_edp_ctrl_power(struct edp_ctrl *ctrl, bool on)
11161116
int msm_edp_ctrl_init(struct msm_edp *edp)
11171117
{
11181118
struct edp_ctrl *ctrl = NULL;
1119-
struct device *dev = &edp->pdev->dev;
1119+
struct device *dev;
11201120
int ret;
11211121

11221122
if (!edp) {
11231123
pr_err("%s: edp is NULL!\n", __func__);
11241124
return -EINVAL;
11251125
}
11261126

1127+
dev = &edp->pdev->dev;
11271128
ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL);
11281129
if (!ctrl)
11291130
return -ENOMEM;

0 commit comments

Comments
 (0)