Commit b4a38ac
AOSCOS: scsi: dc395x: correctly discard the return value in certain reads
There are certain read operations performed in this code which doesn't
really don't need its return value. Those read operations either clears
the FIFO buffer, or clears the interruption status. However, unused read
triggers compiler warnings. With CONFIG_WERROR on, these warnings get
converted into errors:
drivers/scsi/dc395x.c: In function ‘__dc395x_eh_bus_reset’:
drivers/scsi/dc395x.c:97:49: error: value computed is not used [-Werror=unused-value]
97 | #define DC395x_read8(acb,address) (u8)(inb(acb->io_port_base + (address)))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/dc395x.c:1003:9: note: in expansion of macro ‘DC395x_read8’
1003 | DC395x_read8(acb, TRM_S1040_SCSI_INTSTATUS);
| ^~~~~~~~~~~~
drivers/scsi/dc395x.c: In function ‘data_io_transfer’:
drivers/scsi/dc395x.c:97:49: error: value computed is not used [-Werror=unused-value]
97 | #define DC395x_read8(acb,address) (u8)(inb(acb->io_port_base + (address)))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/dc395x.c:2032:33: note: in expansion of macro ‘DC395x_read8’
2032 | DC395x_read8(acb, TRM_S1040_SCSI_FIFO);
Create a new macro DC395x_peek8() to deliberately cast the return value
to void, which tells the compiler we really don't need the return value
of such read operations.
Signed-off-by: Xinhui Yang <cyan@cyano.uk>
Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
(cherry picked from commit ff2493fa584d247df75026d6842f5f60027a42eb)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>1 parent 03db3cb commit b4a38ac
1 file changed
+12
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
97 | 103 | | |
98 | 104 | | |
99 | 105 | | |
| |||
1000 | 1006 | | |
1001 | 1007 | | |
1002 | 1008 | | |
1003 | | - | |
| 1009 | + | |
1004 | 1010 | | |
1005 | 1011 | | |
1006 | 1012 | | |
| |||
2029 | 2035 | | |
2030 | 2036 | | |
2031 | 2037 | | |
2032 | | - | |
2033 | | - | |
| 2038 | + | |
| 2039 | + | |
2034 | 2040 | | |
2035 | 2041 | | |
2036 | 2042 | | |
| |||
2044 | 2050 | | |
2045 | 2051 | | |
2046 | 2052 | | |
2047 | | - | |
| 2053 | + | |
2048 | 2054 | | |
2049 | 2055 | | |
2050 | 2056 | | |
| |||
2892 | 2898 | | |
2893 | 2899 | | |
2894 | 2900 | | |
2895 | | - | |
| 2901 | + | |
2896 | 2902 | | |
2897 | 2903 | | |
2898 | 2904 | | |
| |||
3799 | 3805 | | |
3800 | 3806 | | |
3801 | 3807 | | |
3802 | | - | |
| 3808 | + | |
3803 | 3809 | | |
3804 | 3810 | | |
3805 | 3811 | | |
| |||
0 commit comments