aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/i2c.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/core/i2c.c b/core/i2c.c
index b0d5d34..26926fc 100644
--- a/core/i2c.c
+++ b/core/i2c.c
@@ -51,7 +51,7 @@ static void opal_i2c_request_complete(int rc, struct i2c_request *req)
uint64_t token = (uint64_t)(unsigned long)req->user_data;
opal_queue_msg(OPAL_MSG_ASYNC_COMP, NULL, NULL, token, rc);
- i2c_free_req(req);
+ free(req);
}
static int opal_i2c_request(uint64_t async_token, uint32_t bus_id,
@@ -80,7 +80,7 @@ static int opal_i2c_request(uint64_t async_token, uint32_t bus_id,
return OPAL_PARAMETER;
}
- req = i2c_alloc_req(bus);
+ req = zalloc(sizeof(*req));
if (!req) {
/**
* @fwts-label I2CFailedAllocation
@@ -110,7 +110,7 @@ static int opal_i2c_request(uint64_t async_token, uint32_t bus_id,
req->offset_bytes = oreq->subaddr_sz;
break;
default:
- bus->free_req(req);
+ free(req);
return OPAL_PARAMETER;
}
req->dev_addr = oreq->addr;
@@ -121,14 +121,14 @@ static int opal_i2c_request(uint64_t async_token, uint32_t bus_id,
req->bus = bus;
if (i2c_check_quirk(req, &rc)) {
- i2c_free_req(req);
+ free(req);
return rc;
}
/* Finally, queue the OPAL i2c request and return */
rc = i2c_queue_req(req);
if (rc) {
- i2c_free_req(req);
+ free(req);
return rc;
}
@@ -189,7 +189,7 @@ int i2c_request_send(int bus_id, int dev_addr, int read_write,
return OPAL_PARAMETER;
}
- req = i2c_alloc_req(bus);
+ req = zalloc(sizeof(*req));
if (!req) {
/**
* @fwts-label I2CAllocationFailed
@@ -197,10 +197,11 @@ int i2c_request_send(int bus_id, int dev_addr, int read_write,
* i2c_request. This points to an OPAL bug as OPAL run out of
* memory and this should never happen.
*/
- prlog(PR_ERR, "I2C: i2c_alloc_req failed\n");
+ prlog(PR_ERR, "I2C: allocating i2c_request failed\n");
return OPAL_INTERNAL_ERROR;
}
+ req->bus = bus;
req->dev_addr = dev_addr;
req->op = read_write;
req->offset = offset;
@@ -239,7 +240,7 @@ int i2c_request_send(int bus_id, int dev_addr, int read_write,
(rc) ? "!!!!" : "----", req->op, req->offset,
*(uint64_t*) buf, req->rw_len, tb_to_msecs(waited), timeout, rc);
- i2c_free_req(req);
+ free(req);
if (rc)
return OPAL_HARDWARE;