* [PATCH] staging: gpib: Remove unused value
@ 2024-10-15 21:02 Everest K.C.
2024-10-15 22:56 ` Shuah Khan
2024-10-16 7:37 ` Greg KH
0 siblings, 2 replies; 4+ messages in thread
From: Everest K.C. @ 2024-10-15 21:02 UTC (permalink / raw)
To: dpenkler, gregkh; +Cc: Everest K.C., skhan, linux-staging, linux-kernel
The variable `complement_count` is assigned a value which is again
overwritten in the next statement.
Fix this by removing the first value assigning statement
This issue was reported by Coverity Scan.
Report:
CID 1600790: (#1 of 1): Unused value (UNUSED_VALUE)
assigned_value: Assigning value from length to complement_count here,
but that stored value is overwritten before it can be used.
Fixes: 4e127de14fa7 ("staging: gpib: Add National Instruments USB GPIB driver")
Signed-off-by: Everest K.C. <everestkc@everestkc.com.np>
---
drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c
index 1da263676f2a..e19e18892468 100644
--- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c
+++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c
@@ -759,7 +759,6 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *buffer, size_t length,
if (!out_data)
return -ENOMEM;
out_data[i++] = 0x0d;
- complement_count = length;
complement_count = length - 1;
complement_count = ~complement_count;
out_data[i++] = complement_count & 0xff;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] staging: gpib: Remove unused value
2024-10-15 21:02 [PATCH] staging: gpib: Remove unused value Everest K.C.
@ 2024-10-15 22:56 ` Shuah Khan
2024-10-16 7:37 ` Greg KH
1 sibling, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2024-10-15 22:56 UTC (permalink / raw)
To: Everest K.C., dpenkler, gregkh; +Cc: linux-staging, linux-kernel, Shuah Khan
On 10/15/24 15:02, Everest K.C. wrote:
> The variable `complement_count` is assigned a value which is again
> overwritten in the next statement.
> Fix this by removing the first value assigning statement
>
> This issue was reported by Coverity Scan.
> Report:
> CID 1600790: (#1 of 1): Unused value (UNUSED_VALUE)
> assigned_value: Assigning value from length to complement_count here,
> but that stored value is overwritten before it can be used.
>
> Fixes: 4e127de14fa7 ("staging: gpib: Add National Instruments USB GPIB driver")
> Signed-off-by: Everest K.C. <everestkc@everestkc.com.np>
> ---
> drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c
> index 1da263676f2a..e19e18892468 100644
> --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c
> +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c
> @@ -759,7 +759,6 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *buffer, size_t length,
> if (!out_data)
> return -ENOMEM;
> out_data[i++] = 0x0d;
> - complement_count = length;
> complement_count = length - 1;
> complement_count = ~complement_count;
> out_data[i++] = complement_count & 0xff;
Looks good to me.
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] staging: gpib: Remove unused value
2024-10-15 21:02 [PATCH] staging: gpib: Remove unused value Everest K.C.
2024-10-15 22:56 ` Shuah Khan
@ 2024-10-16 7:37 ` Greg KH
2024-10-16 7:40 ` Everest K.C.
1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2024-10-16 7:37 UTC (permalink / raw)
To: Everest K.C.; +Cc: dpenkler, skhan, linux-staging, linux-kernel
On Tue, Oct 15, 2024 at 03:02:57PM -0600, Everest K.C. wrote:
> The variable `complement_count` is assigned a value which is again
> overwritten in the next statement.
> Fix this by removing the first value assigning statement
>
> This issue was reported by Coverity Scan.
> Report:
> CID 1600790: (#1 of 1): Unused value (UNUSED_VALUE)
> assigned_value: Assigning value from length to complement_count here,
> but that stored value is overwritten before it can be used.
>
> Fixes: 4e127de14fa7 ("staging: gpib: Add National Instruments USB GPIB driver")
Thre is no "fix" needed here. It's not a bug, just a useless operation
(one tha tthe compiler probably just compiles away into nothing.) So
there is no need for a Fixes: tag, sorry.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] staging: gpib: Remove unused value
2024-10-16 7:37 ` Greg KH
@ 2024-10-16 7:40 ` Everest K.C.
0 siblings, 0 replies; 4+ messages in thread
From: Everest K.C. @ 2024-10-16 7:40 UTC (permalink / raw)
To: Greg KH; +Cc: dpenkler, skhan, linux-staging, linux-kernel
On Wed, Oct 16, 2024 at 1:37 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Tue, Oct 15, 2024 at 03:02:57PM -0600, Everest K.C. wrote:
> > The variable `complement_count` is assigned a value which is again
> > overwritten in the next statement.
> > Fix this by removing the first value assigning statement
> >
> > This issue was reported by Coverity Scan.
> > Report:
> > CID 1600790: (#1 of 1): Unused value (UNUSED_VALUE)
> > assigned_value: Assigning value from length to complement_count here,
> > but that stored value is overwritten before it can be used.
> >
> > Fixes: 4e127de14fa7 ("staging: gpib: Add National Instruments USB GPIB driver")
>
> Thre is no "fix" needed here. It's not a bug, just a useless operation
> (one tha tthe compiler probably just compiles away into nothing.) So
> there is no need for a Fixes: tag, sorry.
Noted. Will remove the fixes tag and send V2.
> thanks,
>
> greg k-h
Thanks,
Everest K.C.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-16 7:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15 21:02 [PATCH] staging: gpib: Remove unused value Everest K.C.
2024-10-15 22:56 ` Shuah Khan
2024-10-16 7:37 ` Greg KH
2024-10-16 7:40 ` Everest K.C.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox