Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1315754
| From | Insu Yun <wuninsu@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] vt: correctly check return value of class_create |
| Date | 2016-01-23 22:00 +0100 |
| Message-ID | <qUdrP-8sv-3@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Since class_create can be failed in memory pressure,
its return value should be checked and correctly handled.
Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
drivers/tty/vt/vc_screen.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
index 14a2b5f..5df4bc1 100644
--- a/drivers/tty/vt/vc_screen.c
+++ b/drivers/tty/vt/vc_screen.c
@@ -644,6 +644,8 @@ int __init vcs_init(void)
if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops))
panic("unable to get major %d for vcs device", VCS_MAJOR);
vc_class = class_create(THIS_MODULE, "vc");
+ if (IS_ERR(vc_class))
+ return PTR_ERR(vc_class);
device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs");
device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa");
--
1.9.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] vt: correctly check return value of class_create Insu Yun <wuninsu@gmail.com> - 2016-01-23 22:00 +0100 Re: [PATCH] vt: correctly check return value of class_create Greg KH <gregkh@linuxfoundation.org> - 2016-01-24 01:00 +0100
csiph-web