[lvc-project] [PATCH] staging: comedi: Add driver register error handling in c6xdigio_attach()
Aleksandr Mishin
amishin at t-argos.ru
Tue Aug 27 10:46:54 MSK 2024
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 at t-argos.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
More information about the lvc-project
mailing list