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-01 23:56:44 -0500
commitdbdfb0e2ea3c503397c3c51409842d53c044dd3e (patch)
tree1e5dd56091d075679602e3c19d7500added90fa4
parentf47fbc97d421231cecff806a3d0bfcd1a27f4a66 (diff)
downloadskiboot-dbdfb0e2ea3c503397c3c51409842d53c044dd3e.zip
skiboot-dbdfb0e2ea3c503397c3c51409842d53c044dd3e.tar.gz
skiboot-dbdfb0e2ea3c503397c3c51409842d53c044dd3e.tar.bz2
libflash/ipmi-hiomap: Use error codes rather than abort()
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;