Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1446556
| From | Jes Sorensen <Jes.Sorensen@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/3] staging/rtl8192e: use s8 instead of char |
| Date | 2016-07-19 17:50 +0200 |
| Message-ID | <rWFrr-5Qf-5@gated-at.bofh.it> (permalink) |
| References | <rWFhM-5LH-11@gated-at.bofh.it> <rWFhM-5LH-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Arnd Bergmann <arnd@arndb.de> writes:
> Compiling the rtlwifi drivers for ARM with gcc -Wextra warns about lots of
> incorrect code that results from 'char' being unsigned here, e.g.
>
> staging/rtl8192e/rtl8192e/r8192E_phy.c:1072:36: error: comparison is always false due to limited range of data type [-Werror=type-limits]
> staging/rtl8192e/rtl8192e/r8192E_phy.c:1104:36: error: comparison is always false due to limited range of data type [-Werror=type-limits]
> staging/rtl8192e/rtl8192e/rtl_core.c:1987:16: error: comparison is always false due to limited range of data type [-Werror=type-limits]
> staging/rtl8192e/rtl8192e/rtl_dm.c:782:37: error: comparison is always false due to limited range of data type [-Werror=type-limits]
> staging/rtl8192e/rtl819x_TSProc.c:326:14: error: comparison is always true due to limited range of data type [-Werror=type-limits]
> staging/rtl8192e/rtllib_softmac_wx.c:465:16: error: comparison is always false due to limited range of data type [-Werror=type-limits]
>
> This patch changes all uses of 'char' in this driver that refer to
> 8-bit integers to use 's8' instead, which is signed on all architectures.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 8 ++++----
> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +-
> drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 +++---
> drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 8 ++++----
> drivers/staging/rtl8192e/rtl819x_TSProc.c | 2 +-
> 5 files changed, 13 insertions(+), 13 deletions(-)
>
Most of this looks fine to me. One issue stands out which I don't think
is right:
> diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c
> index 2c8a526773ed..e0a2fe5e6148 100644
> --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c
> +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c
> @@ -323,7 +323,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
> if (ieee->current_network.qos_data.supported == 0) {
> UP = 0;
> } else {
> - if (!IsACValid(TID)) {
> + if (!IsACValid((s8)TID)) {
> netdev_warn(ieee->dev, "%s(): TID(%d) is not valid\n",
> __func__, TID);
> return false;
TID is a 4-bit field, it should never go negative. The cast to s8 seems
wrong to me, if anything it should be using u8. I do realize the macro
IsACValid checks against negative too, but that just looks silly to me.
Cheers,
Jes
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 2/3] staging/rtl8192e: use s8 instead of char Arnd Bergmann <arnd@arndb.de> - 2016-07-19 17:40 +0200
Re: [PATCH 2/3] staging/rtl8192e: use s8 instead of char Jes Sorensen <Jes.Sorensen@redhat.com> - 2016-07-19 17:50 +0200
Re: [PATCH 2/3] staging/rtl8192e: use s8 instead of char Arnd Bergmann <arnd@arndb.de> - 2016-07-19 18:00 +0200
Re: [PATCH 2/3] staging/rtl8192e: use s8 instead of char Jes Sorensen <Jes.Sorensen@redhat.com> - 2016-07-19 18:10 +0200
Re: [PATCH 2/3] staging/rtl8192e: use s8 instead of char Arnd Bergmann <arnd@arndb.de> - 2016-07-20 10:30 +0200
Re: [PATCH 2/3] staging/rtl8192e: use s8 instead of char Jes Sorensen <Jes.Sorensen@redhat.com> - 2016-07-20 13:30 +0200
Re: [PATCH 2/3] staging/rtl8192e: use s8 instead of char Larry Finger <Larry.Finger@lwfinger.net> - 2016-07-20 16:30 +0200
Re: [PATCH 2/3] staging/rtl8192e: use s8 instead of char Arnd Bergmann <arnd@arndb.de> - 2016-07-20 17:20 +0200
Re: [PATCH 2/3] staging/rtl8192e: use s8 instead of char Jes Sorensen <Jes.Sorensen@redhat.com> - 2016-07-20 17:40 +0200
Re: [PATCH 2/3] staging/rtl8192e: use s8 instead of char Arnd Bergmann <arnd@arndb.de> - 2016-07-20 18:10 +0200
Re: [PATCH 2/3] staging/rtl8192e: use s8 instead of char Stefan Lippers-Hollmann <s.l-h@gmx.de> - 2016-07-22 04:40 +0200
Re: [PATCH 2/3] staging/rtl8192e: use s8 instead of char Jes Sorensen <Jes.Sorensen@redhat.com> - 2016-07-22 14:00 +0200
Re: [PATCH 2/3] staging/rtl8192e: use s8 instead of char Arnd Bergmann <arnd@arndb.de> - 2016-07-22 21:50 +0200
Re: [PATCH 2/3] staging/rtl8192e: use s8 instead of char Stefan Lippers-Hollmann <s.l-h@gmx.de> - 2016-07-22 23:00 +0200
csiph-web