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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 30 Mar 2014 15:34:14 +0200
From:	Mathias Krause <minipli@...glemail.com>
To:	Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
	David Woodhouse <dwmw2@...radead.org>
Cc:	linux-kernel@...r.kernel.org,
	Mathias Krause <minipli@...glemail.com>,
	PaX Team <pageexec@...email.hu>, Felipe Balbi <balbi@...com>,
	Anton Vorontsov <anton@...msg.org>
Subject: [PATCH 1/2] pda_power: Statically initialize notifier block

Instead of initializing the notifier block in pda_power_probe(),
initialize it statically. This safes us some code.

Found in the PaX patch, written by the PaX Team.

Cc: PaX Team <pageexec@...email.hu>
Cc: Felipe Balbi <balbi@...com>
Cc: Anton Vorontsov <anton@...msg.org>
Signed-off-by: Mathias Krause <minipli@...glemail.com>
---
 drivers/power/pda_power.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index 0c52e2a0d9..87a963d0a8 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -37,7 +37,6 @@ static int polling;
 
 #if IS_ENABLED(CONFIG_USB_PHY)
 static struct usb_phy *transceiver;
-static struct notifier_block otg_nb;
 #endif
 
 static struct regulator *ac_draw;
@@ -258,6 +257,10 @@ static int otg_handle_notification(struct notifier_block *nb,
 
 	return NOTIFY_OK;
 }
+
+static struct notifier_block otg_nb = {
+	.notifier_call = otg_handle_notification,
+};
 #endif
 
 static int pda_power_probe(struct platform_device *pdev)
@@ -369,7 +372,6 @@ static int pda_power_probe(struct platform_device *pdev)
 
 #if IS_ENABLED(CONFIG_USB_PHY)
 	if (!IS_ERR_OR_NULL(transceiver) && pdata->use_otg_notifier) {
-		otg_nb.notifier_call = otg_handle_notification;
 		ret = usb_register_notifier(transceiver, &otg_nb);
 		if (ret) {
 			dev_err(dev, "failure to register otg notifier\n");
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists