Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99f23c2c authored by Vladimir Zapolskiy's avatar Vladimir Zapolskiy Committed by Linus Torvalds
Browse files

rapidio: fix potential NULL pointer dereference



The change fixes improper check for a returned error value by
class_create() function, which on error returns ERR_PTR() value, thus the
original check always results in a dead code on error path.

Signed-off-by: default avatarVladimir Zapolskiy <vz@mleia.com>
Signed-off-by: default avatarAlexandre Bounine <alexandre.bounine@idt.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c2e7e00b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2669,9 +2669,9 @@ static int __init mport_init(void)

	/* Create device class needed by udev */
	dev_class = class_create(THIS_MODULE, DRV_NAME);
	if (!dev_class) {
	if (IS_ERR(dev_class)) {
		rmcd_error("Unable to create " DRV_NAME " class");
		return -EINVAL;
		return PTR_ERR(dev_class);
	}

	ret = alloc_chrdev_region(&dev_number, 0, RIO_MAX_MPORTS, DRV_NAME);