linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] orinoco: do not resgister NULL pm_notifier function
@ 2009-02-15  9:51 Andrey Borzenkov
  2009-02-15 16:42 ` [Orinoco-devel] " Dave
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Borzenkov @ 2009-02-15  9:51 UTC (permalink / raw)
  To: linux-wireless, orinoco-devel

With DEBUG_NOTIFIERS it results in

[11330.890966] WARNING: at /home/bor/src/linux-git/kernel/notifier.c:88
notifier_call_chain+0x91/0xa0()
[11330.890977] Hardware name: PORTEGE 4000
[11330.890983] Invalid notifier called! ...

Without DEBUG_NOTIFIERS it most likely crashes on NULL pointer.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>

---

This condition is triggered by default config options so it is 2.6.29
material. Patch is intentionally against 2.6.29 base and not against
wireless-next.

 drivers/net/wireless/orinoco/orinoco.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/orinoco/orinoco.c b/drivers/net/wireless/orinoco/orinoco.c
index 6514e46..728fd3f 100644
--- a/drivers/net/wireless/orinoco/orinoco.c
+++ b/drivers/net/wireless/orinoco/orinoco.c
@@ -3158,8 +3158,20 @@ static int orinoco_pm_notifier(struct notifier_block *notifier,
 
 	return NOTIFY_DONE;
 }
+
+static void orinoco_register_pm_notifier(struct orinoco_private *priv)
+{
+	priv->pm_notifier.notifier_call = orinoco_pm_notifier;
+	register_pm_notifier(&priv->pm_notifier);
+}
+
+static void orinoco_unregister_pm_notifier(struct orinoco_private *priv)
+{
+	unregister_pm_notifier(&priv->pm_notifier);
+}
 #else /* !PM_SLEEP || HERMES_CACHE_FW_ON_INIT */
-#define orinoco_pm_notifier NULL
+#define orinoco_register_pm_notifier(priv) do { } while(0)
+#define orinoco_unregister_pm_notifier(priv) do { } while(0)
 #endif
 
 /********************************************************************/
@@ -3653,8 +3665,7 @@ struct net_device
 	priv->cached_fw = NULL;
 
 	/* Register PM notifiers */
-	priv->pm_notifier.notifier_call = orinoco_pm_notifier;
-	register_pm_notifier(&priv->pm_notifier);
+	orinoco_register_pm_notifier(priv);
 
 	return dev;
 }
@@ -3678,7 +3689,7 @@ void free_orinocodev(struct net_device *dev)
 		kfree(rx_data);
 	}
 
-	unregister_pm_notifier(&priv->pm_notifier);
+	orinoco_unregister_pm_notifier(priv);
 	orinoco_uncache_fw(priv);
 
 	priv->wpa_ie_len = 0;


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

* Re: [Orinoco-devel] [PATCH] orinoco: do not resgister NULL pm_notifier function
  2009-02-15  9:51 [PATCH] orinoco: do not resgister NULL pm_notifier function Andrey Borzenkov
@ 2009-02-15 16:42 ` Dave
  0 siblings, 0 replies; 2+ messages in thread
From: Dave @ 2009-02-15 16:42 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: linux-wireless, orinoco-devel

Andrey Borzenkov wrote:
> With DEBUG_NOTIFIERS it results in
> 
> [11330.890966] WARNING: at /home/bor/src/linux-git/kernel/notifier.c:88
> notifier_call_chain+0x91/0xa0()
> [11330.890977] Hardware name: PORTEGE 4000
> [11330.890983] Invalid notifier called! ...
> 
> Without DEBUG_NOTIFIERS it most likely crashes on NULL pointer.
> 
> Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>

Acked-by: David Kilroy <kilroyd@googlemail.com>

Thanks for finding and fixing up the bugs I keep injecting :)

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

end of thread, other threads:[~2009-02-15 16:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-15  9:51 [PATCH] orinoco: do not resgister NULL pm_notifier function Andrey Borzenkov
2009-02-15 16:42 ` [Orinoco-devel] " Dave

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).