Commit 4ed6627b authored by Luca Weiss's avatar Luca Weiss Committed by Mauro Carvalho Chehab

media: i2c: ov5670: Use dev_err_probe in probe function

Replace the unusual const char *err_msg usage with dev_err_probe which
also handles -EPROBE_DEFER better by not printing the message to kmsg.
Signed-off-by: default avatarLuca Weiss <luca@z3ntu.xyz>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 30cbaa02
...@@ -2648,17 +2648,13 @@ static int ov5670_gpio_probe(struct ov5670 *ov5670) ...@@ -2648,17 +2648,13 @@ static int ov5670_gpio_probe(struct ov5670 *ov5670)
static int ov5670_probe(struct i2c_client *client) static int ov5670_probe(struct i2c_client *client)
{ {
struct ov5670 *ov5670; struct ov5670 *ov5670;
const char *err_msg;
u32 input_clk = 0; u32 input_clk = 0;
bool full_power; bool full_power;
int ret; int ret;
ov5670 = devm_kzalloc(&client->dev, sizeof(*ov5670), GFP_KERNEL); ov5670 = devm_kzalloc(&client->dev, sizeof(*ov5670), GFP_KERNEL);
if (!ov5670) { if (!ov5670)
ret = -ENOMEM; return -ENOMEM;
err_msg = "devm_kzalloc() error";
goto error_print;
}
ov5670->xvclk = devm_clk_get(&client->dev, NULL); ov5670->xvclk = devm_clk_get(&client->dev, NULL);
if (!IS_ERR_OR_NULL(ov5670->xvclk)) if (!IS_ERR_OR_NULL(ov5670->xvclk))
...@@ -2680,29 +2676,23 @@ static int ov5670_probe(struct i2c_client *client) ...@@ -2680,29 +2676,23 @@ static int ov5670_probe(struct i2c_client *client)
v4l2_i2c_subdev_init(&ov5670->sd, client, &ov5670_subdev_ops); v4l2_i2c_subdev_init(&ov5670->sd, client, &ov5670_subdev_ops);
ret = ov5670_regulators_probe(ov5670); ret = ov5670_regulators_probe(ov5670);
if (ret) { if (ret)
err_msg = "Regulators probe failed"; return dev_err_probe(&client->dev, ret, "Regulators probe failed\n");
goto error_print;
}
ret = ov5670_gpio_probe(ov5670); ret = ov5670_gpio_probe(ov5670);
if (ret) { if (ret)
err_msg = "GPIO probe failed"; return dev_err_probe(&client->dev, ret, "GPIO probe failed\n");
goto error_print;
}
full_power = acpi_dev_state_d0(&client->dev); full_power = acpi_dev_state_d0(&client->dev);
if (full_power) { if (full_power) {
ret = ov5670_runtime_resume(&client->dev); ret = ov5670_runtime_resume(&client->dev);
if (ret) { if (ret)
err_msg = "Power up failed"; return dev_err_probe(&client->dev, ret, "Power up failed\n");
goto error_print;
}
/* Check module identity */ /* Check module identity */
ret = ov5670_identify_module(ov5670); ret = ov5670_identify_module(ov5670);
if (ret) { if (ret) {
err_msg = "ov5670_identify_module() error"; dev_err_probe(&client->dev, ret, "ov5670_identify_module() error\n");
goto error_power_off; goto error_power_off;
} }
} }
...@@ -2714,7 +2704,7 @@ static int ov5670_probe(struct i2c_client *client) ...@@ -2714,7 +2704,7 @@ static int ov5670_probe(struct i2c_client *client)
ret = ov5670_init_controls(ov5670); ret = ov5670_init_controls(ov5670);
if (ret) { if (ret) {
err_msg = "ov5670_init_controls() error"; dev_err_probe(&client->dev, ret, "ov5670_init_controls() error\n");
goto error_mutex_destroy; goto error_mutex_destroy;
} }
...@@ -2727,7 +2717,7 @@ static int ov5670_probe(struct i2c_client *client) ...@@ -2727,7 +2717,7 @@ static int ov5670_probe(struct i2c_client *client)
ov5670->pad.flags = MEDIA_PAD_FL_SOURCE; ov5670->pad.flags = MEDIA_PAD_FL_SOURCE;
ret = media_entity_pads_init(&ov5670->sd.entity, 1, &ov5670->pad); ret = media_entity_pads_init(&ov5670->sd.entity, 1, &ov5670->pad);
if (ret) { if (ret) {
err_msg = "media_entity_pads_init() error"; dev_err_probe(&client->dev, ret, "media_entity_pads_init() error\n");
goto error_handler_free; goto error_handler_free;
} }
...@@ -2741,7 +2731,7 @@ static int ov5670_probe(struct i2c_client *client) ...@@ -2741,7 +2731,7 @@ static int ov5670_probe(struct i2c_client *client)
/* Async register for subdev */ /* Async register for subdev */
ret = v4l2_async_register_subdev_sensor(&ov5670->sd); ret = v4l2_async_register_subdev_sensor(&ov5670->sd);
if (ret < 0) { if (ret < 0) {
err_msg = "v4l2_async_register_subdev() error"; dev_err_probe(&client->dev, ret, "v4l2_async_register_subdev() error\n");
goto error_pm_disable; goto error_pm_disable;
} }
...@@ -2764,9 +2754,6 @@ static int ov5670_probe(struct i2c_client *client) ...@@ -2764,9 +2754,6 @@ static int ov5670_probe(struct i2c_client *client)
if (full_power) if (full_power)
ov5670_runtime_suspend(&client->dev); ov5670_runtime_suspend(&client->dev);
error_print:
dev_err(&client->dev, "%s: %s %d\n", __func__, err_msg, ret);
return ret; return ret;
} }
......
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