From 64e69291d9d6c14c133910bb0d8b5072fbd4397d Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Wed, 19 Nov 2014 17:24:58 +0530 Subject: [PATCH] greybus: Pass '*ptr' to sizeof() wherever possible Signed-off-by: Viresh Kumar Reviewed-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/ap.c | 8 ++++---- drivers/staging/greybus/i2c-gb.c | 4 ++-- drivers/staging/greybus/manifest.c | 2 +- drivers/staging/greybus/sdio-gb.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/greybus/ap.c b/drivers/staging/greybus/ap.c index ef64068da1b8..a3bf146e5562 100644 --- a/drivers/staging/greybus/ap.c +++ b/drivers/staging/greybus/ap.c @@ -83,7 +83,7 @@ static void svc_handshake(struct svc_function_handshake *handshake, { struct svc_msg *svc_msg; - if (payload_length != sizeof(struct svc_function_handshake)) { + if (payload_length != sizeof(*handshake)) { dev_err(hd->parent, "Illegal size of svc handshake message %d\n", payload_length); @@ -114,7 +114,7 @@ static void svc_handshake(struct svc_function_handshake *handshake, svc_msg->header.function_id = SVC_FUNCTION_HANDSHAKE; svc_msg->header.message_type = SVC_MSG_DATA; svc_msg->header.payload_length = - cpu_to_le16(sizeof(struct svc_function_handshake)); + cpu_to_le16(sizeof(*handshake)); svc_msg->handshake.version_major = GREYBUS_VERSION_MAJOR; svc_msg->handshake.version_minor = GREYBUS_VERSION_MINOR; svc_msg->handshake.handshake_type = SVC_HANDSHAKE_AP_HELLO; @@ -128,7 +128,7 @@ static void svc_management(struct svc_function_unipro_management *management, struct gb_module *module; int ret; - if (payload_length != sizeof(struct svc_function_unipro_management)) { + if (payload_length != sizeof(*management)) { dev_err(hd->parent, "Illegal size of svc management message %d\n", payload_length); @@ -221,7 +221,7 @@ static void svc_power(struct svc_function_power *power, * big, we can just check the union of the whole structure to validate * the size of this message. */ - if (payload_length != sizeof(struct svc_function_power)) { + if (payload_length != sizeof(*power)) { dev_err(hd->parent, "Illegal size of svc power message %d\n", payload_length); diff --git a/drivers/staging/greybus/i2c-gb.c b/drivers/staging/greybus/i2c-gb.c index 3374173b012a..c810c429d529 100644 --- a/drivers/staging/greybus/i2c-gb.c +++ b/drivers/staging/greybus/i2c-gb.c @@ -311,8 +311,8 @@ gb_i2c_transfer_request(struct gb_connection *connection, else data_out_size += (u32)msg->len; - request_size = sizeof(struct gb_i2c_transfer_request); - request_size += msg_count * sizeof(struct gb_i2c_transfer_op); + request_size = sizeof(*request); + request_size += msg_count * sizeof(*op); request_size += data_out_size; /* Response consists only of incoming data */ diff --git a/drivers/staging/greybus/manifest.c b/drivers/staging/greybus/manifest.c index 9014611c6a7a..37540350cb75 100644 --- a/drivers/staging/greybus/manifest.c +++ b/drivers/staging/greybus/manifest.c @@ -81,7 +81,7 @@ static int identify_descriptor(struct greybus_descriptor *desc, size_t size) } break; case GREYBUS_TYPE_STRING: - expected_size = sizeof(struct greybus_descriptor_header); + expected_size = sizeof(*desc_header); expected_size += sizeof(struct greybus_descriptor_string); expected_size += (size_t)desc->string.length; if (desc_size < expected_size) { diff --git a/drivers/staging/greybus/sdio-gb.c b/drivers/staging/greybus/sdio-gb.c index 4775ed0c7bea..3f1136566491 100644 --- a/drivers/staging/greybus/sdio-gb.c +++ b/drivers/staging/greybus/sdio-gb.c @@ -46,7 +46,7 @@ static int gb_sdio_connection_init(struct gb_connection *connection) struct mmc_host *mmc; struct gb_sdio_host *host; - mmc = mmc_alloc_host(sizeof(struct gb_sdio_host), &connection->dev); + mmc = mmc_alloc_host(sizeof(*host), &connection->dev); if (!mmc) return -ENOMEM;