summaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys/include/visorbus.h
diff options
context:
space:
mode:
authorTim Sell <Timothy.Sell@unisys.com>2015-07-09 13:27:42 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-07-14 18:34:58 -0700
commitd15a65be5542ab0c4792a54cf90419fbaf741791 (patch)
treef00d387c4a687a7f15a55468ce72f470023b4682 /drivers/staging/unisys/include/visorbus.h
parentaddce19f58c52a03314e2d8a1e30708dabf9bf30 (diff)
downloadop-kernel-dev-d15a65be5542ab0c4792a54cf90419fbaf741791.zip
op-kernel-dev-d15a65be5542ab0c4792a54cf90419fbaf741791.tar.gz
staging: unisys: prevent faults processing messages
Prevent faults processing messages for devices that no driver has yet registered to handle. Previously, code of the form: drv = to_visor_driver(dev->device.driver); if (!drv) goto away; was not having the desired intent, because to_visor_driver() was essentially returning garbage if its argument was NULL. The only existing case of this is in initiate_chipset_device_pause_resume(), which is called during IOVM service partition recovery. We were thus faulting when IOVM service partition recovery was initiated on a bus that had at least one device for which no function driver had registered (visorbus_register_visor_driver). Signed-off-by: Tim Sell <Timothy.Sell@unisys.com> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/unisys/include/visorbus.h')
-rw-r--r--drivers/staging/unisys/include/visorbus.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index e4a21e4..a0144c6 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -113,7 +113,8 @@ struct visor_driver {
struct driver_attribute version_attr;
};
-#define to_visor_driver(x) container_of(x, struct visor_driver, driver)
+#define to_visor_driver(x) ((x) ? \
+ (container_of(x, struct visor_driver, driver)) : (NULL))
/** A device type for things "plugged" into the visorbus bus */
OpenPOWER on IntegriCloud