[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y9VfmT3Umlo7LHN6@kroah.com>
Date: Sat, 28 Jan 2023 18:47:05 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Tom Rix <trix@...hat.com>
Cc: johan@...nel.org, elder@...nel.org, greybus-dev@...ts.linaro.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] greybus: remove unused header variable in
gb_operation_message_alloc()
On Sat, Jan 28, 2023 at 07:57:06AM -0800, Tom Rix wrote:
> cppcheck reports
> drivers/greybus/operation.c:365:31: style: Variable 'header' is not assigned a value. [unassignedVariable]
> struct gb_operation_msg_hdr *header;
> ^
That's not a real problem.
> 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()")
This is not a bug that is being fixed.
> Signed-off-by: Tom Rix <trix@...hat.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);
The compiler does not use any extra room for header, so this should be
fine, it's not a real issue.
cppcheck almost never finds anything real, be careful...
thanks,
greg k-h
Powered by blists - more mailing lists