]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
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 ef64068da1b8a67fa94d09843fb4aa0c99e5ab5c..a3bf146e5562be05a4f0a1ab7f295ea3e4f2466d 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 3374173b012a9aca09f141750a068e4d32cc1033..c810c429d529291f31367bf98a3cc8dbcd823678 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 9014611c6a7a947941a52226fdda6324bea8f795..37540350cb7506daabc78f1250038640c97d7222 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 4775ed0c7beada816539d185d288b10c110b329a..3f1136566491c49a5a2c774097c112334a80ff9e 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;