lkml.org 
[lkml]   [2023]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] greybus: remove unused header variable in gb_operation_message_alloc()
Date
cppcheck reports
drivers/greybus/operation.c:365:31: style: Variable 'header' is not assigned a value. [unassignedVariable]
struct gb_operation_msg_hdr *header;
^
header is only used to calculate the size of the messge. This can be done without a variable
but rather with calling sizeof() with the struct type.

Fixes: dc779229b538 ("greybus: introduce gb_operation_message_init()")
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/greybus/operation.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/greybus/operation.c b/drivers/greybus/operation.c
index 8459e9bc0749..9d322fc6531b 100644
--- a/drivers/greybus/operation.c
+++ b/drivers/greybus/operation.c
@@ -362,8 +362,7 @@ gb_operation_message_alloc(struct gb_host_device *hd, u8 type,
size_t payload_size, gfp_t gfp_flags)
{
struct gb_message *message;
- struct gb_operation_msg_hdr *header;
- size_t message_size = payload_size + sizeof(*header);
+ size_t message_size = payload_size + sizeof(struct gb_operation_msg_hdr);

if (message_size > hd->buffer_size_max) {
dev_warn(&hd->dev, "requested message size too big (%zu > %zu)\n",
--
2.26.3
\
 
 \ /
  Last update: 2023-03-27 00:00    [W:1.084 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site