diff --git a/drivers/base/physical_location.c b/drivers/base/physical_location.c index 4c1a52ecd7f6..fbd9f9839e92 100644 --- a/drivers/base/physical_location.c +++ b/drivers/base/physical_location.c @@ -24,6 +24,8 @@ bool dev_add_physical_location(struct device *dev) dev->physical_location = kzalloc(sizeof(*dev->physical_location), GFP_KERNEL); + if (!dev->physical_location) + return false; dev->physical_location->panel = pld->panel; dev->physical_location->vertical_position = pld->vertical_position; dev->physical_location->horizontal_position = pld->horizontal_position;