i2c: mux: gpmux: Simplify with dev_err_probe()
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@kernel.org>
This commit is contained in:
Родитель
74779f6eeb
Коммит
432d159a02
|
@ -85,18 +85,14 @@ static int i2c_mux_probe(struct platform_device *pdev)
|
|||
return -ENOMEM;
|
||||
|
||||
mux->control = devm_mux_control_get(dev, NULL);
|
||||
if (IS_ERR(mux->control)) {
|
||||
if (PTR_ERR(mux->control) != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get control-mux\n");
|
||||
return PTR_ERR(mux->control);
|
||||
}
|
||||
if (IS_ERR(mux->control))
|
||||
return dev_err_probe(dev, PTR_ERR(mux->control),
|
||||
"failed to get control-mux\n");
|
||||
|
||||
parent = mux_parent_adapter(dev);
|
||||
if (IS_ERR(parent)) {
|
||||
if (PTR_ERR(parent) != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get i2c-parent adapter\n");
|
||||
return PTR_ERR(parent);
|
||||
}
|
||||
if (IS_ERR(parent))
|
||||
return dev_err_probe(dev, PTR_ERR(parent),
|
||||
"failed to get i2c-parent adapter\n");
|
||||
|
||||
children = of_get_child_count(np);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче