char: hvc: check for error case
Subsystems (2)
PATCH 1/1 char: hvc: check for error case
hvc_alloc() may fail, if so exit from init() with error.
---
I cannot compile this driver at all, so it is not tested.
drivers/char/hvc_tile.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/char/hvc_tile.c +3 -2
@@ -61,7 +61,8 @@ console_initcall(hvc_tile_console_init);static int __init hvc_tile_init (void ) { -hvc_alloc (0 ,0 , &hvc_tile_get_put_ops,128 ); -return 0 ; +struct hvc_struct *s; + s =hvc_alloc (0 ,0 , &hvc_tile_get_put_ops,128 ); +return IS_ERR (s) ?PTR_ERR (s) :0 ; }device_initcall (hvc_tile_init);
Signature · 1 line
1.7.0.4
Quoted 3 lines · Vasiliy Kulikov
hvc_alloc()may fail, if so exit frominit()with error.Signed-off-by Vasiliy Kulikov <[email protected]>
Thanks, accepted into my tree (for the next merge window). In practice all this means is in debug mode we'll get a warning from do_one_initcall() rather than silence, but you're right, it's technically better. :-)
Quoted 21 lines
---
I cannot compile this driver at all, so it is not tested.drivers/char/hvc_tile.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)drivers/char/hvc_tile.c +3
-2@@ -61,7 +61,8 @@ console_initcall(hvc_tile_console_init);static int __init hvc_tile_init (void ) { -hvc_alloc (0 ,0 , &hvc_tile_get_put_ops,128 ); -return 0 ; +struct hvc_struct *s; + s =hvc_alloc (0 ,0 , &hvc_tile_get_put_ops,128 ); +return IS_ERR (s) ?PTR_ERR (s) :0 ; }device_initcall (hvc_tile_init);
Signature · 2 lines
Chris Metcalf, Tilera Corp. http://www.tilera.com
Quoted 3 lines · Chris Metcalf
Thanks, accepted into my tree (for the next merge window). In practice all this means is in debug mode we'll get a warning from
do_one_initcall()rather than silence, but you're right, it's technically better. :-)
Anyway it's better, if user sees warning in the dmesg, he/she might response to this situation.
Best,
Signature · 1 line
Vasiliy