lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20241129030130.3754-1-tianyaxiong@kylinos.cn>
Date: Fri, 29 Nov 2024 11:01:30 +0800
From: Yaxiong Tian <tianyaxiong@...inos.cn>
To: gregkh@...uxfoundation.org,
	rafael@...nel.org
Cc: linux-kernel@...r.kernel.org,
	Yaxiong Tian <tianyaxiong@...inos.cn>
Subject: [PATCH] drivers core: bus: Remove unnecessary NULL assignments in the bus_register() function

In bus_register(), Priv is a local pointer variable, so its assignment
can be ignored and the function can be returned directly. This can reduce
the NULL checks in the subsequent kfree function.

Signed-off-by: Yaxiong Tian <tianyaxiong@...inos.cn>
---
 drivers/base/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 657c93c38b0d..c1fd2860e397 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -923,7 +923,7 @@ int bus_register(const struct bus_type *bus)
 bus_uevent_fail:
 	kset_unregister(&priv->subsys);
 	/* Above kset_unregister() will kfree @priv */
-	priv = NULL;
+	return retval;
 out:
 	kfree(priv);
 	return retval;
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ