aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2018-11-01 23:17:26 +1030
committerStewart Smith <stewart@linux.ibm.com>2018-11-02 18:17:06 +1100
commitbec5a5f89adc129ad5681960180674b81002303e (patch)
tree57b7602908a25ab025b62fb69af3fc1b84975c59
parent3f49e5220086d0b247f3ab148199450eee80c78a (diff)
downloadskiboot-bec5a5f89adc129ad5681960180674b81002303e.zip
skiboot-bec5a5f89adc129ad5681960180674b81002303e.tar.gz
skiboot-bec5a5f89adc129ad5681960180674b81002303e.tar.bz2
libflash/ipmi-hiomap: Use error codes rather than abort()
[ Upstream commit dbdfb0e2ea3c503397c3c51409842d53c044dd3e ] Admittedly the situations are pretty dire, and usually indicate a programming failure on the BMC's part, but abort() seems a bit over the top. The technique was useful for development but shouldn't have made it into production. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
-rw-r--r--libflash/ipmi-hiomap.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libflash/ipmi-hiomap.c b/libflash/ipmi-hiomap.c
index a7bd6af..850fb3d 100644
--- a/libflash/ipmi-hiomap.c
+++ b/libflash/ipmi-hiomap.c
@@ -137,14 +137,16 @@ static void ipmi_hiomap_cmd_cb(struct ipmi_msg *msg)
if (msg->resp_size != 6) {
prerror("%u: Unexpected response size: %u\n", msg->data[0],
msg->resp_size);
- abort();
+ res->cc = IPMI_ERR_UNSPECIFIED;
+ break;
}
ctx->version = msg->data[2];
if (ctx->version < 2) {
prerror("Failed to negotiate protocol v2 or higher: %d\n",
ctx->version);
- abort();
+ res->cc = IPMI_ERR_UNSPECIFIED;
+ break;
}
parms = (struct hiomap_v2_info *)&msg->data[3];
@@ -159,7 +161,8 @@ static void ipmi_hiomap_cmd_cb(struct ipmi_msg *msg)
if (msg->resp_size != 6) {
prerror("%u: Unexpected response size: %u\n", msg->data[0],
msg->resp_size);
- abort();
+ res->cc = IPMI_ERR_UNSPECIFIED;
+ break;
}
parms = (struct hiomap_v2_flash_info *)&msg->data[2];
@@ -177,7 +180,8 @@ static void ipmi_hiomap_cmd_cb(struct ipmi_msg *msg)
if (msg->resp_size != 8) {
prerror("%u: Unexpected response size: %u\n", msg->data[0],
msg->resp_size);
- abort();
+ res->cc = IPMI_ERR_UNSPECIFIED;
+ break;
}
parms = (struct hiomap_v2_create_window *)&msg->data[2];
@@ -316,7 +320,7 @@ static bool hiomap_window_move(struct ipmi_hiomap *ctx, uint8_t command,
if (len != 0 && *size == 0) {
prerror("Invalid window properties: len: %llu, size: %llu\n",
len, *size);
- abort();
+ return false;
}
prlog(PR_DEBUG, "Opened %s window from 0x%x for %u bytes at 0x%x\n",
@@ -806,7 +810,7 @@ static int ipmi_hiomap_get_flash_info(struct blocklevel_device *bl,
return rc;
if (!hiomap_get_flash_info(ctx)) {
- abort();
+ return FLASH_ERR_DEVICE_GONE;
}
ctx->bl.erase_mask = ctx->erase_granule - 1;