Re: [PATCH] staging: fix ignoring return value warning
From: Dan Carpenter
Date: Mon Feb 08 2021 - 08:48:35 EST
On Sun, Feb 07, 2021 at 05:23:28PM +0800, Youling Tang wrote:
> Fix the below ignoring return value warning for device_reset.
>
> drivers/staging/mt7621-dma/mtk-hsdma.c:685:2: warning: ignoring return value
> of function declared with 'warn_unused_result' attribute [-Wunused-result]
> device_reset(&pdev->dev);
> ^~~~~~~~~~~~ ~~~~~~~~~~
> drivers/staging/ralink-gdma/ralink-gdma.c:836:2: warning: ignoring return value
> of function declared with 'warn_unused_result' attribute [-Wunused-result]
> device_reset(&pdev->dev);
> ^~~~~~~~~~~~ ~~~~~~~~~~
>
We can't really do this sort of fix without the hardware to test it.
This could be the correct fix or perhaps switching to device_reset_optional()
is the correct fix. We can't know unless we have the hardware to test.
People think silencing warnings is good, but it's actually bad. The
warning is there to show us a potential bug. If we silence the warning
without fixing the bug, then we it's like when your mom tells you to
clean up the room and you instead just switch off the light. It doesn't
fix the problem, it only makes it harder to find.
regards,
dan carpenter