treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / rtc / rtc-generic.c
blob89ae78e93b839be6768c0ac9437066c1998e3ad1
1 // SPDX-License-Identifier: GPL-2.0-only
2 /* rtc-generic: RTC driver using the generic RTC abstraction
4 * Copyright (C) 2008 Kyle McMartin <kyle@mcmartin.ca>
5 */
7 #include <linux/kernel.h>
8 #include <linux/module.h>
9 #include <linux/time.h>
10 #include <linux/platform_device.h>
11 #include <linux/rtc.h>
13 static int __init generic_rtc_probe(struct platform_device *dev)
15 struct rtc_device *rtc;
16 const struct rtc_class_ops *ops = dev_get_platdata(&dev->dev);
18 rtc = devm_rtc_device_register(&dev->dev, "rtc-generic",
19 ops, THIS_MODULE);
20 if (IS_ERR(rtc))
21 return PTR_ERR(rtc);
23 platform_set_drvdata(dev, rtc);
25 return 0;
28 static struct platform_driver generic_rtc_driver = {
29 .driver = {
30 .name = "rtc-generic",
34 module_platform_driver_probe(generic_rtc_driver, generic_rtc_probe);
36 MODULE_AUTHOR("Kyle McMartin <kyle@mcmartin.ca>");
37 MODULE_LICENSE("GPL");
38 MODULE_DESCRIPTION("Generic RTC driver");
39 MODULE_ALIAS("platform:rtc-generic");