public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] isa: Remove unnecessary checks
@ 2023-05-17 12:50 Vladislav Efanov
  2023-05-19  1:46 ` William Breathitt Gray
  0 siblings, 1 reply; 3+ messages in thread
From: Vladislav Efanov @ 2023-05-17 12:50 UTC (permalink / raw)
  To: William Breathitt Gray
  Cc: Vladislav Efanov, Greg Kroah-Hartman, Rafael J. Wysocki,
	Rene Herman, linux-kernel, lvc-project

The isa_dev->dev.platform_data is initialized with incoming
parameter isa_driver. After it isa_dev->dev.platform_data is
checked for NULL, but incoming parameter isa_driver is not
NULL since it is dereferenced many times before this check.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: a5117ba7da37 ("[PATCH] Driver model: add ISA bus")
Signed-off-by: Vladislav Efanov <VEfanov@ispras.ru>
---
 drivers/base/isa.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/base/isa.c b/drivers/base/isa.c
index 55e3ee2da98f..675ad3139224 100644
--- a/drivers/base/isa.c
+++ b/drivers/base/isa.c
@@ -149,11 +149,8 @@ int isa_register_driver(struct isa_driver *isa_driver, unsigned int ndev)
 			break;
 		}
 
-		if (isa_dev->dev.platform_data) {
-			isa_dev->next = isa_driver->devices;
-			isa_driver->devices = &isa_dev->dev;
-		} else
-			device_unregister(&isa_dev->dev);
+		isa_dev->next = isa_driver->devices;
+		isa_driver->devices = &isa_dev->dev;
 	}
 
 	if (!error && !isa_driver->devices)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-31 18:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-17 12:50 [PATCH] isa: Remove unnecessary checks Vladislav Efanov
2023-05-19  1:46 ` William Breathitt Gray
2023-05-31 18:03   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox