summaryrefslogtreecommitdiffstats
path: root/drivers/message/i2o/driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message/i2o/driver.c')
-rw-r--r--drivers/message/i2o/driver.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c
index bebdd509b5d8..393be8e2914c 100644
--- a/drivers/message/i2o/driver.c
+++ b/drivers/message/i2o/driver.c
@@ -180,7 +180,13 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m)
{
struct i2o_driver *drv;
struct i2o_message __iomem *msg = i2o_msg_out_to_virt(c, m);
- u32 context = readl(&msg->u.s.icntxt);
+ u32 context;
+ unsigned long flags;
+
+ if(unlikely(!msg))
+ return -EIO;
+
+ context = readl(&msg->u.s.icntxt);
if (unlikely(context >= i2o_max_drivers)) {
osm_warn("%s: Spurious reply to unknown driver %d\n", c->name,
@@ -188,9 +194,9 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m)
return -EIO;
}
- spin_lock(&i2o_drivers_lock);
+ spin_lock_irqsave(&i2o_drivers_lock, flags);
drv = i2o_drivers[context];
- spin_unlock(&i2o_drivers_lock);
+ spin_unlock_irqrestore(&i2o_drivers_lock, flags);
if (unlikely(!drv)) {
osm_warn("%s: Spurious reply to unknown driver %d\n", c->name,
OpenPOWER on IntegriCloud