Skip to content

Commit

Permalink
orinoco: do not resgister NULL pm_notifier function
Browse files Browse the repository at this point in the history
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>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Andrey Borzenkov authored and John W. Linville committed Feb 23, 2009
1 parent 486a87f commit 5c138dc
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions drivers/net/wireless/orinoco/orinoco.c
Original file line number Diff line number Diff line change
Expand Up @@ -3157,8 +3157,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

/********************************************************************/
Expand Down Expand Up @@ -3648,8 +3660,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;
}
Expand All @@ -3673,7 +3684,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;
Expand Down

0 comments on commit 5c138dc

Please sign in to comment.