linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: core: remove unneeded assignment in hid_process_report()
@ 2022-07-01 11:27 Lukas Bulwahn
  2022-07-01 12:44 ` Tom Rix
  2022-07-21 11:37 ` Jiri Kosina
  0 siblings, 2 replies; 3+ messages in thread
From: Lukas Bulwahn @ 2022-07-01 11:27 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, linux-input
  Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix, llvm,
	kernel-janitors, linux-kernel, Lukas Bulwahn

Commit bebcc522fbee ("HID: core: for input reports, process the usages by
priority list") split the iteration into two distinct loops in
hid_process_report().

After this change, the variable field is only used while iterating in the
second loop and the assignment of values to this variable in the first loop
is simply not needed.

Remove the unneeded assignment during retrieval. No functional change and
no change in the resulting object code.

This was discovered as a dead store with clang-analyzer.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
Benjamin, Jiri, please pick this minor non-urgent clean-up patch.

 drivers/hid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 00154a1cd2d8..b7f5566e338d 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1662,7 +1662,7 @@ static void hid_process_report(struct hid_device *hid,
 
 	/* first retrieve all incoming values in data */
 	for (a = 0; a < report->maxfield; a++)
-		hid_input_fetch_field(hid, field = report->field[a], data);
+		hid_input_fetch_field(hid, report->field[a], data);
 
 	if (!list_empty(&report->field_entry_list)) {
 		/* INPUT_REPORT, we have a priority list of fields */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: core: remove unneeded assignment in hid_process_report()
  2022-07-01 11:27 [PATCH] HID: core: remove unneeded assignment in hid_process_report() Lukas Bulwahn
@ 2022-07-01 12:44 ` Tom Rix
  2022-07-21 11:37 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rix @ 2022-07-01 12:44 UTC (permalink / raw)
  To: Lukas Bulwahn, Jiri Kosina, Benjamin Tissoires, linux-input
  Cc: Nathan Chancellor, Nick Desaulniers, llvm, kernel-janitors, linux-kernel


On 7/1/22 4:27 AM, Lukas Bulwahn wrote:
> Commit bebcc522fbee ("HID: core: for input reports, process the usages by
> priority list") split the iteration into two distinct loops in
> hid_process_report().
>
> After this change, the variable field is only used while iterating in the
> second loop and the assignment of values to this variable in the first loop
> is simply not needed.
>
> Remove the unneeded assignment during retrieval. No functional change and
> no change in the resulting object code.
>
> This was discovered as a dead store with clang-analyzer.
>
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> ---
> Benjamin, Jiri, please pick this minor non-urgent clean-up patch.
>
>   drivers/hid/hid-core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 00154a1cd2d8..b7f5566e338d 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -1662,7 +1662,7 @@ static void hid_process_report(struct hid_device *hid,
>   
>   	/* first retrieve all incoming values in data */
>   	for (a = 0; a < report->maxfield; a++)
> -		hid_input_fetch_field(hid, field = report->field[a], data);
> +		hid_input_fetch_field(hid, report->field[a], data);
>   
>   	if (!list_empty(&report->field_entry_list)) {
>   		/* INPUT_REPORT, we have a priority list of fields */
Reviewed-by: Tom Rix <trix@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: core: remove unneeded assignment in hid_process_report()
  2022-07-01 11:27 [PATCH] HID: core: remove unneeded assignment in hid_process_report() Lukas Bulwahn
  2022-07-01 12:44 ` Tom Rix
@ 2022-07-21 11:37 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2022-07-21 11:37 UTC (permalink / raw)
  To: Lukas Bulwahn
  Cc: Benjamin Tissoires, linux-input, Nathan Chancellor,
	Nick Desaulniers, Tom Rix, llvm, kernel-janitors, linux-kernel

On Fri, 1 Jul 2022, Lukas Bulwahn wrote:

> Commit bebcc522fbee ("HID: core: for input reports, process the usages by
> priority list") split the iteration into two distinct loops in
> hid_process_report().
> 
> After this change, the variable field is only used while iterating in the
> second loop and the assignment of values to this variable in the first loop
> is simply not needed.
> 
> Remove the unneeded assignment during retrieval. No functional change and
> no change in the resulting object code.
> 
> This was discovered as a dead store with clang-analyzer.
> 
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> ---
> Benjamin, Jiri, please pick this minor non-urgent clean-up patch.
> 
>  drivers/hid/hid-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 00154a1cd2d8..b7f5566e338d 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -1662,7 +1662,7 @@ static void hid_process_report(struct hid_device *hid,
>  
>  	/* first retrieve all incoming values in data */
>  	for (a = 0; a < report->maxfield; a++)
> -		hid_input_fetch_field(hid, field = report->field[a], data);
> +		hid_input_fetch_field(hid, report->field[a], data);
>  
>  	if (!list_empty(&report->field_entry_list)) {

Applied, thanks Lukas.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-21 11:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01 11:27 [PATCH] HID: core: remove unneeded assignment in hid_process_report() Lukas Bulwahn
2022-07-01 12:44 ` Tom Rix
2022-07-21 11:37 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).