struct mc13xxx *mc13xxx;
int rtcrst_pending;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
mc13xxx_unlock(mc13xxx);
- priv->rtc = rtc_device_register(pdev->name,
- &pdev->dev, &mc13xxx_rtc_ops, THIS_MODULE);
+ priv->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
+ &mc13xxx_rtc_ops, THIS_MODULE);
if (IS_ERR(priv->rtc)) {
ret = PTR_ERR(priv->rtc);
mc13xxx_unlock(mc13xxx);
platform_set_drvdata(pdev, NULL);
- kfree(priv);
}
return ret;
mc13xxx_lock(priv->mc13xxx);
- rtc_device_unregister(priv->rtc);
-
mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_TODA, priv);
mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_1HZ, priv);
mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_RTCRST, priv);
platform_set_drvdata(pdev, NULL);
- kfree(priv);
-
return 0;
}