summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/storage
diff options
context:
space:
mode:
authorRichard Spiegel <richard.spiegel@amd.corp-partner.google.com>2018-11-02 14:23:52 -0700
committerPatrick Georgi <pgeorgi@google.com>2018-11-16 09:42:34 +0000
commit509d99ca6b34de7909ca944584b613b547a58e34 (patch)
treef15c897078cd20ded1c0996e364102b5770ce7f5 /payloads/libpayload/drivers/storage
parentb59c1f4345d5528bcec2ede8487f11c04ac4de05 (diff)
payloads/libpayload/drivers/storage: Get rid of void pointer math
Pointer math with void pointers is illegal in many compilers, though it works with GCC because it assumes size of void to be 1. In this particular situation, dev->buf is already pointer to u8, and there's no need to convert to void *. BUG=b:118484178 TEST=Build libpayload. Change-Id: Ib70b8ce11abc88c35be4092f097cfff385921f46 Signed-off-by: Richard Spiegel <richard.spiegel@silverbackltd.com> Reviewed-on: https://review.coreboot.org/29442 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Diffstat (limited to 'payloads/libpayload/drivers/storage')
-rw-r--r--payloads/libpayload/drivers/storage/ahci_common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/payloads/libpayload/drivers/storage/ahci_common.c b/payloads/libpayload/drivers/storage/ahci_common.c
index bcb0ce70bc..ef9d43d306 100644
--- a/payloads/libpayload/drivers/storage/ahci_common.c
+++ b/payloads/libpayload/drivers/storage/ahci_common.c
@@ -72,7 +72,7 @@ static u8 *ahci_prdbuf_init(ahci_dev_t *const dev,
if ((u32)user_buf & 1) {
printf("ahci: Odd buffer pointer (%p).\n", user_buf);
if (dev->buf) /* orphaned buffer */
- free((void *)dev->buf - *(dev->buf - 1));
+ free(dev->buf - *(dev->buf - 1));
dev->buf = malloc(len + 2);
if (!dev->buf)
return NULL;
@@ -100,7 +100,7 @@ static void ahci_prdbuf_finalize(ahci_dev_t *const dev)
if (dev->buf) {
if (dev->write_back)
memcpy(dev->user_buf, dev->buf, dev->buflen);
- free((void *)dev->buf - *(dev->buf - 1));
+ free(dev->buf - *(dev->buf - 1));
}
dev->buf = NULL;
dev->user_buf = NULL;