1
0
Fork 0

greybus: Pass '*ptr' to sizeof() wherever possible

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>
hifive-unleashed-5.1
Viresh Kumar 2014-11-19 17:24:58 +05:30 committed by Greg Kroah-Hartman
parent a4040ab7e6
commit 64e69291d9
4 changed files with 8 additions and 8 deletions

View 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);

View 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 */

View 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) {

View 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;