greybus: Pass '*ptr' to sizeof() wherever possible
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 19 Nov 2014 11:54:58 +0000 (17:24 +0530)
committerGreg Kroah-Hartman <greg@kroah.com>
Wed, 19 Nov 2014 18:38:50 +0000 (10:38 -0800)
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/ap.c
drivers/staging/greybus/i2c-gb.c
drivers/staging/greybus/manifest.c
drivers/staging/greybus/sdio-gb.c

index ef64068..a3bf146 100644 (file)
@@ -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);
index 3374173..c810c42 100644 (file)
@@ -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 */
index 9014611..3754035 100644 (file)
@@ -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) {
index 4775ed0..3f11365 100644 (file)
@@ -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;