Skip to content

Commit 153dab7

Browse files
mitaIngo Molnar
authored andcommitted
x86: use platform_device_register_simple()
Cleanup pcspeaker.c Signed-off-by: Akinobu Mita <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 279b0bb commit 153dab7

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

arch/x86/kernel/pcspeaker.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
#include <linux/platform_device.h>
2-
#include <linux/errno.h>
2+
#include <linux/err.h>
33
#include <linux/init.h>
44

55
static __init int add_pcspkr(void)
66
{
77
struct platform_device *pd;
8-
int ret;
98

10-
pd = platform_device_alloc("pcspkr", -1);
11-
if (!pd)
12-
return -ENOMEM;
9+
pd = platform_device_register_simple("pcspkr", -1, NULL, 0);
1310

14-
ret = platform_device_add(pd);
15-
if (ret)
16-
platform_device_put(pd);
17-
18-
return ret;
11+
return IS_ERR(pd) ? PTR_ERR(pd) : 0;
1912
}
2013
device_initcall(add_pcspkr);

0 commit comments

Comments
 (0)