mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 20:51:44 +00:00
nvmem: rockchip-otp: Improve probe error handling
Enhance error handling in the probe function by making use of dev_err_probe(), which ensures the error code is always printed, in addition to the specified error message. Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Tested-by: Vincent Legoll <vincent.legoll@gmail.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Message-ID: <20230611140330.154222-13-srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d325c9dd2b
commit
912517345b
@ -235,10 +235,8 @@ static int rockchip_otp_probe(struct platform_device *pdev)
|
|||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
data = of_device_get_match_data(dev);
|
data = of_device_get_match_data(dev);
|
||||||
if (!data) {
|
if (!data)
|
||||||
dev_err(dev, "failed to get match data\n");
|
return dev_err_probe(dev, -EINVAL, "failed to get match data\n");
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
otp = devm_kzalloc(&pdev->dev, sizeof(struct rockchip_otp),
|
otp = devm_kzalloc(&pdev->dev, sizeof(struct rockchip_otp),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
@ -249,7 +247,8 @@ static int rockchip_otp_probe(struct platform_device *pdev)
|
|||||||
otp->dev = dev;
|
otp->dev = dev;
|
||||||
otp->base = devm_platform_ioremap_resource(pdev, 0);
|
otp->base = devm_platform_ioremap_resource(pdev, 0);
|
||||||
if (IS_ERR(otp->base))
|
if (IS_ERR(otp->base))
|
||||||
return PTR_ERR(otp->base);
|
return dev_err_probe(dev, PTR_ERR(otp->base),
|
||||||
|
"failed to ioremap resource\n");
|
||||||
|
|
||||||
otp->clks = devm_kcalloc(dev, data->num_clks, sizeof(*otp->clks),
|
otp->clks = devm_kcalloc(dev, data->num_clks, sizeof(*otp->clks),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
@ -261,18 +260,22 @@ static int rockchip_otp_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
ret = devm_clk_bulk_get(dev, data->num_clks, otp->clks);
|
ret = devm_clk_bulk_get(dev, data->num_clks, otp->clks);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return dev_err_probe(dev, ret, "failed to get clocks\n");
|
||||||
|
|
||||||
otp->rst = devm_reset_control_array_get_exclusive(dev);
|
otp->rst = devm_reset_control_array_get_exclusive(dev);
|
||||||
if (IS_ERR(otp->rst))
|
if (IS_ERR(otp->rst))
|
||||||
return PTR_ERR(otp->rst);
|
return dev_err_probe(dev, PTR_ERR(otp->rst),
|
||||||
|
"failed to get resets\n");
|
||||||
|
|
||||||
otp_config.size = data->size;
|
otp_config.size = data->size;
|
||||||
otp_config.priv = otp;
|
otp_config.priv = otp;
|
||||||
otp_config.dev = dev;
|
otp_config.dev = dev;
|
||||||
nvmem = devm_nvmem_register(dev, &otp_config);
|
|
||||||
|
|
||||||
return PTR_ERR_OR_ZERO(nvmem);
|
nvmem = devm_nvmem_register(dev, &otp_config);
|
||||||
|
if (IS_ERR(nvmem))
|
||||||
|
return dev_err_probe(dev, PTR_ERR(nvmem),
|
||||||
|
"failed to register nvmem device\n");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct platform_driver rockchip_otp_driver = {
|
static struct platform_driver rockchip_otp_driver = {
|
||||||
|
Loading…
Reference in New Issue
Block a user