From 407a264f6fecd2d0d02056765ab48c2be61d1a55 Mon Sep 17 00:00:00 2001 From: Alistair Popple Date: Tue, 14 Apr 2015 13:36:03 +1000 Subject: ipmi: Check for ipmi backend presence before use Not all ipmi related functions check for a valid backend before attempting to use it. Under normal circumstances this should not happen as the platform should always register an ipmi backend. However a system should be able to boot without a functional ipmi backend, which is sometimes the case during system bringup. This patch adds presence checks for an ipmi backend before attempting to use it, thus allowing a system with a non-functional backend to boot without ipmi. Signed-off-by: Alistair Popple Reviewed-by: Joel Stanley Signed-off-by: Stewart Smith --- hw/ipmi/ipmi-fru.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'hw') diff --git a/hw/ipmi/ipmi-fru.c b/hw/ipmi/ipmi-fru.c index be3ca90..ddcb3d6 100644 --- a/hw/ipmi/ipmi-fru.c +++ b/hw/ipmi/ipmi-fru.c @@ -213,6 +213,8 @@ static int fru_write(void) */ msg = ipmi_mkmsg(IPMI_DEFAULT_INTERFACE, IPMI_WRITE_FRU, fru_write_complete, NULL, NULL, FRU_DATA_SIZE + 5, 2); + if (!msg) + return OPAL_RESOURCE; msg->data[0] = fru_dev_id; /* FRU Device ID */ msg->data[1] = 0x0; /* Offset LSB (we always write a new common header) */ -- cgit v1.1