Skip to content

Commit 90d4d27

Browse files
a3fgregkh
authored andcommitted
drm: bridge: adv7511: use dev_err_probe in probe function
[ Upstream commit 2a865248399a13bb2b2bcc50297069a7521de258 ] adv7511 probe may need to be attempted multiple times before no -EPROBE_DEFER is returned. Currently, every such probe results in an error message: [ 4.534229] adv7511 1-003d: failed to find dsi host [ 4.580288] adv7511 1-003d: failed to find dsi host This is misleading, as there is no error and probe deferral is normal behavior. Fix this by using dev_err_probe that will suppress -EPROBE_DEFER errors. While at it, we touch all dev_err in the probe path. This makes the code more concise and included the error code everywhere to aid user in debugging. Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Ahmad Fatoum <[email protected]> Signed-off-by: Neil Armstrong <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Stable-dep-of: 81adbd3ff21c ("drm: adv7511: Fix use-after-free in adv7533_attach_dsi()") Signed-off-by: Sasha Levin <[email protected]>
1 parent 2d43119 commit 90d4d27

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,10 +1224,8 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
12241224
return ret;
12251225

12261226
ret = adv7511_init_regulators(adv7511);
1227-
if (ret) {
1228-
dev_err(dev, "failed to init regulators\n");
1229-
return ret;
1230-
}
1227+
if (ret)
1228+
return dev_err_probe(dev, ret, "failed to init regulators\n");
12311229

12321230
/*
12331231
* The power down GPIO is optional. If present, toggle it from active to

drivers/gpu/drm/bridge/adv7511/adv7533.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,14 @@ int adv7533_attach_dsi(struct adv7511 *adv)
146146
};
147147

148148
host = of_find_mipi_dsi_host_by_node(adv->host_node);
149-
if (!host) {
150-
dev_err(dev, "failed to find dsi host\n");
151-
return -EPROBE_DEFER;
152-
}
149+
if (!host)
150+
return dev_err_probe(dev, -EPROBE_DEFER,
151+
"failed to find dsi host\n");
153152

154153
dsi = devm_mipi_dsi_device_register_full(dev, host, &info);
155-
if (IS_ERR(dsi)) {
156-
dev_err(dev, "failed to create dsi device\n");
157-
return PTR_ERR(dsi);
158-
}
154+
if (IS_ERR(dsi))
155+
return dev_err_probe(dev, PTR_ERR(dsi),
156+
"failed to create dsi device\n");
159157

160158
adv->dsi = dsi;
161159

@@ -165,10 +163,8 @@ int adv7533_attach_dsi(struct adv7511 *adv)
165163
MIPI_DSI_MODE_NO_EOT_PACKET | MIPI_DSI_MODE_VIDEO_HSE;
166164

167165
ret = devm_mipi_dsi_attach(dev, dsi);
168-
if (ret < 0) {
169-
dev_err(dev, "failed to attach dsi to host\n");
170-
return ret;
171-
}
166+
if (ret < 0)
167+
return dev_err_probe(dev, ret, "failed to attach dsi to host\n");
172168

173169
return 0;
174170
}

0 commit comments

Comments
 (0)