From: Tom Rix <trix@redhat.com>
To: johan@kernel.org, elder@kernel.org, gregkh@linuxfoundation.org
Cc: greybus-dev@lists.linaro.org, linux-kernel@vger.kernel.org,
Tom Rix <trix@redhat.com>
Subject: [PATCH] greybus: remove unused header variable in gb_operation_message_alloc()
Date: Sat, 28 Jan 2023 07:57:06 -0800 [thread overview]
Message-ID: <20230128155706.1243283-1-trix@redhat.com> (raw)
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
next reply other threads:[~2023-01-28 15:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-28 15:57 Tom Rix [this message]
2023-01-28 17:47 ` [PATCH] greybus: remove unused header variable in gb_operation_message_alloc() Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230128155706.1243283-1-trix@redhat.com \
--to=trix@redhat.com \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox