Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1423423 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2016-06-15 22:40 +0200 |
| Last post | 2016-06-16 23:30 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] net: sfc: avoid -Wtype-limits warning Arnd Bergmann <arnd@arndb.de> - 2016-06-15 22:40 +0200
Re: [PATCH] net: sfc: avoid -Wtype-limits warning Bert Kenward <bkenward@solarflare.com> - 2016-06-16 12:40 +0200
Re: [PATCH] net: sfc: avoid -Wtype-limits warning David Miller <davem@davemloft.net> - 2016-06-16 23:30 +0200
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-06-15 22:40 +0200 |
| Subject | [PATCH] net: sfc: avoid -Wtype-limits warning |
| Message-ID | <rKpLs-7fO-9@gated-at.bofh.it> |
When building with -Wextra, we get a harmless warning from the
EFX_EXTRACT_OWORD32 macro:
ethernet/sfc/farch.c: In function 'efx_farch_test_registers':
ethernet/sfc/farch.c:119:30: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
ethernet/sfc/farch.c:124:144: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
ethernet/sfc/farch.c:124:392: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
ethernet/sfc/farch.c:124:731: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
The macro and the caller are both correct, but we can avoid the
warning by changing the index variable to a signed type.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/ethernet/sfc/farch.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
index 133e9e35be9e..4c83739d158f 100644
--- a/drivers/net/ethernet/sfc/farch.c
+++ b/drivers/net/ethernet/sfc/farch.c
@@ -104,7 +104,8 @@ int efx_farch_test_registers(struct efx_nic *efx,
const struct efx_farch_register_test *regs,
size_t n_regs)
{
- unsigned address = 0, i, j;
+ unsigned address = 0;
+ int i, j;
efx_oword_t mask, imask, original, reg, buf;
for (i = 0; i < n_regs; ++i) {
--
2.9.0
[toc] | [next] | [standalone]
| From | Bert Kenward <bkenward@solarflare.com> |
|---|---|
| Date | 2016-06-16 12:40 +0200 |
| Message-ID | <rKCSm-7c3-7@gated-at.bofh.it> |
| In reply to | #1423423 |
On 15/06/16 21:31, Arnd Bergmann wrote:
> When building with -Wextra, we get a harmless warning from the
> EFX_EXTRACT_OWORD32 macro:
>
> ethernet/sfc/farch.c: In function 'efx_farch_test_registers':
> ethernet/sfc/farch.c:119:30: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
> ethernet/sfc/farch.c:124:144: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
> ethernet/sfc/farch.c:124:392: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
> ethernet/sfc/farch.c:124:731: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
>
> The macro and the caller are both correct, but we can avoid the
> warning by changing the index variable to a signed type.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Bert Kenward <bkenward@solarflare.com>
> ---
> drivers/net/ethernet/sfc/farch.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
> index 133e9e35be9e..4c83739d158f 100644
> --- a/drivers/net/ethernet/sfc/farch.c
> +++ b/drivers/net/ethernet/sfc/farch.c
> @@ -104,7 +104,8 @@ int efx_farch_test_registers(struct efx_nic *efx,
> const struct efx_farch_register_test *regs,
> size_t n_regs)
> {
> - unsigned address = 0, i, j;
> + unsigned address = 0;
> + int i, j;
> efx_oword_t mask, imask, original, reg, buf;
>
> for (i = 0; i < n_regs; ++i) {
>
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-06-16 23:30 +0200 |
| Message-ID | <rKN1o-53x-25@gated-at.bofh.it> |
| In reply to | #1423423 |
From: Arnd Bergmann <arnd@arndb.de> Date: Wed, 15 Jun 2016 22:31:10 +0200 > When building with -Wextra, we get a harmless warning from the > EFX_EXTRACT_OWORD32 macro: > > ethernet/sfc/farch.c: In function 'efx_farch_test_registers': > ethernet/sfc/farch.c:119:30: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] > ethernet/sfc/farch.c:124:144: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] > ethernet/sfc/farch.c:124:392: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] > ethernet/sfc/farch.c:124:731: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] > > The macro and the caller are both correct, but we can avoid the > warning by changing the index variable to a signed type. > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> Applied, thanks.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web