mirror of
https://github.com/torvalds/linux.git
synced 2025-04-12 16:47:42 +00:00
rtc: s5m: convert to dev_err_probe() where appropriate
dev_err_probe() exists to simplify code and harmonise error messages, there's no reason not to use it here. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: André Draszik <andre.draszik@linaro.org> Link: https://lore.kernel.org/r/20250304-rtc-cleanups-v2-16-d4689a71668c@linaro.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
parent
e6403ae59c
commit
0c57c2e72c
@ -626,11 +626,10 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
info->rtc_24hr_mode = 1;
|
info->rtc_24hr_mode = 1;
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(info->dev, "%s: fail to write controlm reg(%d)\n",
|
return dev_err_probe(info->dev, ret,
|
||||||
__func__, ret);
|
"%s: fail to write controlm reg\n",
|
||||||
return ret;
|
__func__);
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -669,26 +668,21 @@ static int s5m_rtc_probe(struct platform_device *pdev)
|
|||||||
alarm_irq = S5M8767_IRQ_RTCA1;
|
alarm_irq = S5M8767_IRQ_RTCA1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(&pdev->dev,
|
return dev_err_probe(&pdev->dev, -ENODEV,
|
||||||
"Device type %lu is not supported by RTC driver\n",
|
"Device type %lu is not supported by RTC driver\n",
|
||||||
platform_get_device_id(pdev)->driver_data);
|
platform_get_device_id(pdev)->driver_data);
|
||||||
return -ENODEV;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i2c = devm_i2c_new_dummy_device(&pdev->dev, s5m87xx->i2c->adapter,
|
i2c = devm_i2c_new_dummy_device(&pdev->dev, s5m87xx->i2c->adapter,
|
||||||
RTC_I2C_ADDR);
|
RTC_I2C_ADDR);
|
||||||
if (IS_ERR(i2c)) {
|
if (IS_ERR(i2c))
|
||||||
dev_err(&pdev->dev, "Failed to allocate I2C for RTC\n");
|
return dev_err_probe(&pdev->dev, PTR_ERR(i2c),
|
||||||
return PTR_ERR(i2c);
|
"Failed to allocate I2C for RTC\n");
|
||||||
}
|
|
||||||
|
|
||||||
info->regmap = devm_regmap_init_i2c(i2c, regmap_cfg);
|
info->regmap = devm_regmap_init_i2c(i2c, regmap_cfg);
|
||||||
if (IS_ERR(info->regmap)) {
|
if (IS_ERR(info->regmap))
|
||||||
ret = PTR_ERR(info->regmap);
|
return dev_err_probe(&pdev->dev, PTR_ERR(info->regmap),
|
||||||
dev_err(&pdev->dev, "Failed to allocate RTC register map: %d\n",
|
"Failed to allocate RTC register map\n");
|
||||||
ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
info->dev = &pdev->dev;
|
info->dev = &pdev->dev;
|
||||||
info->s5m87xx = s5m87xx;
|
info->s5m87xx = s5m87xx;
|
||||||
@ -696,11 +690,10 @@ static int s5m_rtc_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
if (s5m87xx->irq_data) {
|
if (s5m87xx->irq_data) {
|
||||||
info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq);
|
info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq);
|
||||||
if (info->irq <= 0) {
|
if (info->irq <= 0)
|
||||||
dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n",
|
return dev_err_probe(&pdev->dev, -EINVAL,
|
||||||
alarm_irq);
|
"Failed to get virtual IRQ %d\n",
|
||||||
return -EINVAL;
|
alarm_irq);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_set_drvdata(pdev, info);
|
platform_set_drvdata(pdev, info);
|
||||||
@ -724,11 +717,10 @@ static int s5m_rtc_probe(struct platform_device *pdev)
|
|||||||
ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
|
ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
|
||||||
s5m_rtc_alarm_irq, 0, "rtc-alarm0",
|
s5m_rtc_alarm_irq, 0, "rtc-alarm0",
|
||||||
info);
|
info);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
|
return dev_err_probe(&pdev->dev, ret,
|
||||||
info->irq, ret);
|
"Failed to request alarm IRQ %d\n",
|
||||||
return ret;
|
info->irq);
|
||||||
}
|
|
||||||
device_init_wakeup(&pdev->dev, true);
|
device_init_wakeup(&pdev->dev, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user