[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240827074654.14131-1-amishin@t-argos.ru>
Date: Tue, 27 Aug 2024 10:46:54 +0300
From: Aleksandr Mishin <amishin@...rgos.ru>
To: Greg Kroah-Hartman <gregkh@...e.de>
CC: Aleksandr Mishin <amishin@...rgos.ru>, Ian Abbott <abbotti@....co.uk>, H
Hartley Sweeten <hsweeten@...ionengravers.com>,
<linux-kernel@...r.kernel.org>, <lvc-project@...uxtesting.org>
Subject: [PATCH] staging: comedi: Add driver register error handling in c6xdigio_attach()
In c6xdigio_attach() there is a pnp_register_driver() call without return
value check. But pnp_register_driver() can return error in some case
(e.q. kzalloc() error in bus_add_driver() etc.).
Add return value check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 2c89e159cd2f ("Staging: comedi: add c6xdigio driver")
Signed-off-by: Aleksandr Mishin <amishin@...rgos.ru>
---
drivers/comedi/drivers/c6xdigio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/comedi/drivers/c6xdigio.c b/drivers/comedi/drivers/c6xdigio.c
index 14b90d1c64dc..3f507f53518d 100644
--- a/drivers/comedi/drivers/c6xdigio.c
+++ b/drivers/comedi/drivers/c6xdigio.c
@@ -250,7 +250,9 @@ static int c6xdigio_attach(struct comedi_device *dev,
return ret;
/* Make sure that PnP ports get activated */
- pnp_register_driver(&c6xdigio_pnp_driver);
+ ret = pnp_register_driver(&c6xdigio_pnp_driver);
+ if (ret)
+ return ret;
s = &dev->subdevices[0];
/* pwm output subdevice */
--
2.30.2
Powered by blists - more mailing lists