mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 07:04:44 +00:00
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>
This commit is contained in:
parent
a4040ab7e6
commit
64e69291d9
4 changed files with 8 additions and 8 deletions
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue