Skip to content

Commit 4a2b958

Browse files
committed
media: sur40: Remove uninitialized_var() usage
Using uninitialized_var() is dangerous as it papers over real bugs[1] (or can in the future), and suppresses unrelated compiler warnings (e.g. "unused variable"). If the compiler thinks it is uninitialized, either simply initialize the variable or make compiler changes. As a precursor to removing[2] this[3] macro[4], just remove this variable since it was actually unused: drivers/input/touchscreen/sur40.c:459:6: warning: variable 'packet_id' set but not used [-Wunused-but-set-variable] 459 | u32 packet_id; | ^~~~~~~~~ However, in keeping with the documentation desires outlined in commit 335abae ("Input: sur40 - silence unnecessary noisy debug output"), comment out the assignment instead of removing it. [1] https://lore.kernel.org/lkml/[email protected]/ [2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/ [3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/ [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/ Fixes: 335abae ("Input: sur40 - silence unnecessary noisy debug output") Reviewed-by: Nick Desaulniers <[email protected]> Signed-off-by: Kees Cook <[email protected]>
1 parent 1ef7904 commit 4a2b958

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/input/touchscreen/sur40.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,6 @@ static void sur40_poll(struct input_dev *input)
456456
{
457457
struct sur40_state *sur40 = input_get_drvdata(input);
458458
int result, bulk_read, need_blobs, packet_blobs, i;
459-
u32 uninitialized_var(packet_id);
460-
461459
struct sur40_header *header = &sur40->bulk_in_buffer->header;
462460
struct sur40_blob *inblob = &sur40->bulk_in_buffer->blobs[0];
463461

@@ -491,7 +489,7 @@ static void sur40_poll(struct input_dev *input)
491489
if (need_blobs == -1) {
492490
need_blobs = le16_to_cpu(header->count);
493491
dev_dbg(sur40->dev, "need %d blobs\n", need_blobs);
494-
packet_id = le32_to_cpu(header->packet_id);
492+
/* packet_id = le32_to_cpu(header->packet_id); */
495493
}
496494

497495
/*

0 commit comments

Comments
 (0)