mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
char: misc: Fix improper and inaccurate error code returned by misc_init()
[ Upstream commit 0ef1fe4bc38673db72e39b700b29c50dfcc5a415 ] misc_init() returns -EIO for __register_chrdev() invocation failure, but: - -EIO is for I/O error normally, but __register_chrdev() does not do I/O. - -EIO can not cover various error codes returned by __register_chrdev(). Fix by returning error code of __register_chrdev(). Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com> Link: https://lore.kernel.org/r/20250620-fix_mischar-v1-3-6c2716bbf1fa@oss.qualcomm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f8818e29d2
commit
a29868db6d
@@ -314,8 +314,8 @@ static int __init misc_init(void)
|
||||
if (err)
|
||||
goto fail_remove;
|
||||
|
||||
err = -EIO;
|
||||
if (__register_chrdev(MISC_MAJOR, 0, MINORMASK + 1, "misc", &misc_fops))
|
||||
err = __register_chrdev(MISC_MAJOR, 0, MINORMASK + 1, "misc", &misc_fops);
|
||||
if (err < 0)
|
||||
goto fail_printk;
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user