LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers
@ 2018-05-06 22:02 Nathan Chancellor
2018-05-06 22:02 ` [PATCH 2/7] staging: ks7010: Remove unused variables Nathan Chancellor
` (6 more replies)
0 siblings, 7 replies; 18+ messages in thread
From: Nathan Chancellor @ 2018-05-06 22:02 UTC (permalink / raw)
To: devel; +Cc: Greg Kroah-Hartman, Nathan Chancellor, linux-kernel
This satisfies a checkpatch.pl warning and is the preferred method for
notating the license due to its lack of ambiguity.
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/staging/ks7010/ks7010_sdio.c | 5 +----
drivers/staging/ks7010/ks7010_sdio.h | 5 +----
drivers/staging/ks7010/ks_hostif.c | 5 +----
drivers/staging/ks7010/ks_hostif.h | 5 +----
drivers/staging/ks7010/ks_wlan.h | 5 +----
drivers/staging/ks7010/ks_wlan_ioctl.h | 5 +----
drivers/staging/ks7010/ks_wlan_net.c | 5 +----
drivers/staging/ks7010/michael_mic.c | 5 +----
drivers/staging/ks7010/michael_mic.h | 5 +----
9 files changed, 9 insertions(+), 36 deletions(-)
diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index b29f48c421cc..6a5565d479ac 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -1,13 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Driver for KeyStream, KS7010 based SDIO cards.
*
* Copyright (C) 2006-2008 KeyStream Corp.
* Copyright (C) 2009 Renesas Technology Corp.
* Copyright (C) 2016 Sang Engineering, Wolfram Sang
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
*/
#include <linux/atomic.h>
diff --git a/drivers/staging/ks7010/ks7010_sdio.h b/drivers/staging/ks7010/ks7010_sdio.h
index 95ac86b94a7c..831b2f105f58 100644
--- a/drivers/staging/ks7010/ks7010_sdio.h
+++ b/drivers/staging/ks7010/ks7010_sdio.h
@@ -1,12 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Driver for KeyStream, KS7010 based SDIO cards.
*
* Copyright (C) 2006-2008 KeyStream Corp.
* Copyright (C) 2009 Renesas Technology Corp.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
*/
#ifndef _KS7010_SDIO_H
#define _KS7010_SDIO_H
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 9a05374d950e..c0a9a67dc0b4 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1,12 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Driver for KeyStream wireless LAN cards.
*
* Copyright (C) 2005-2008 KeyStream Corp.
* Copyright (C) 2009 Renesas Technology Corp.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
*/
#include <linux/if_arp.h>
diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h
index 05ff5ca5da19..172d38f17595 100644
--- a/drivers/staging/ks7010/ks_hostif.h
+++ b/drivers/staging/ks7010/ks_hostif.h
@@ -1,12 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Driver for KeyStream wireless LAN
*
* Copyright (c) 2005-2008 KeyStream Corp.
* Copyright (C) 2009 Renesas Technology Corp.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
*/
#ifndef _KS_HOSTIF_H_
diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index 2894b0c3816c..5070af86115f 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -1,12 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Driver for KeyStream IEEE802.11 b/g wireless LAN cards.
*
* Copyright (C) 2006-2008 KeyStream Corp.
* Copyright (C) 2009 Renesas Technology Corp.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
*/
#ifndef _KS_WLAN_H
diff --git a/drivers/staging/ks7010/ks_wlan_ioctl.h b/drivers/staging/ks7010/ks_wlan_ioctl.h
index e45a33291b46..97c7d95de411 100644
--- a/drivers/staging/ks7010/ks_wlan_ioctl.h
+++ b/drivers/staging/ks7010/ks_wlan_ioctl.h
@@ -1,12 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Driver for KeyStream 11b/g wireless LAN
*
* Copyright (c) 2005-2008 KeyStream Corp.
* Copyright (C) 2009 Renesas Technology Corp.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
*/
#ifndef _KS_WLAN_IOCTL_H
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 694decc05c88..e96477937f65 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -1,12 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Driver for KeyStream 11b/g wireless LAN
*
* Copyright (C) 2005-2008 KeyStream Corp.
* Copyright (C) 2009 Renesas Technology Corp.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
*/
#include <linux/atomic.h>
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index 2128c8441405..e6bd70846e98 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -1,12 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Driver for KeyStream wireless LAN
*
* Copyright (C) 2005-2008 KeyStream Corp.
* Copyright (C) 2009 Renesas Technology Corp.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
*/
#include <asm/unaligned.h>
diff --git a/drivers/staging/ks7010/michael_mic.h b/drivers/staging/ks7010/michael_mic.h
index eb22fdd660d9..f0ac164b999b 100644
--- a/drivers/staging/ks7010/michael_mic.h
+++ b/drivers/staging/ks7010/michael_mic.h
@@ -1,12 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Driver for KeyStream wireless LAN
*
* Copyright (C) 2005-2008 KeyStream Corp.
* Copyright (C) 2009 Renesas Technology Corp.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
*/
/* MichaelMIC routine define */
--
2.17.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/7] staging: ks7010: Remove unused variables
2018-05-06 22:02 [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers Nathan Chancellor
@ 2018-05-06 22:02 ` Nathan Chancellor
2018-05-07 17:59 ` Nathan Chancellor
2018-05-06 22:03 ` [PATCH 3/7] staging: ks7010: Remove unnecessary limit checks Nathan Chancellor
` (5 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: Nathan Chancellor @ 2018-05-06 22:02 UTC (permalink / raw)
To: devel; +Cc: Greg Kroah-Hartman, Nathan Chancellor, linux-kernel
GCC warns these variables are all set but never used so remove them.
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/staging/ks7010/ks_hostif.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index c0a9a67dc0b4..4c2f8f710c6e 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -354,7 +354,6 @@ void hostif_data_indication(struct ks_wlan_private *priv)
unsigned short auth_type;
unsigned char temp[256];
struct ether_hdr *eth_hdr;
- unsigned short eth_proto;
struct ieee802_1x_hdr *aa1x_hdr;
size_t size;
int ret;
@@ -369,7 +368,6 @@ void hostif_data_indication(struct ks_wlan_private *priv)
get_word(priv); /* Reserve Area */
eth_hdr = (struct ether_hdr *)(priv->rxp);
- eth_proto = ntohs(eth_hdr->h_proto);
/* source address check */
if (ether_addr_equal(&priv->eth_addr[0], eth_hdr->h_source)) {
@@ -464,13 +462,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
struct net_device *dev = priv->net_dev;
u32 mib_status;
u32 mib_attribute;
- u16 mib_val_size;
- u16 mib_val_type;
mib_status = get_dword(priv); /* MIB status */
mib_attribute = get_dword(priv); /* MIB atttibute */
- mib_val_size = get_word(priv); /* MIB value size */
- mib_val_type = get_word(priv); /* MIB value type */
if (mib_status) {
netdev_err(priv->net_dev, "attribute=%08X, status=%08X\n",
@@ -792,9 +786,6 @@ void hostif_ps_adhoc_set_confirm(struct ks_wlan_private *priv)
static
void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv)
{
- u16 result_code;
-
- result_code = get_word(priv);
priv->infra_status = 1; /* infrastructure mode set */
hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM);
}
@@ -872,14 +863,13 @@ static
void hostif_phy_information_confirm(struct ks_wlan_private *priv)
{
struct iw_statistics *wstats = &priv->wstats;
- unsigned char rssi, signal, noise;
+ unsigned char rssi, signal;
unsigned char link_speed;
unsigned int transmitted_frame_count, received_fragment_count;
unsigned int failed_count, fcs_error_count;
rssi = get_byte(priv);
signal = get_byte(priv);
- noise = get_byte(priv);
link_speed = get_byte(priv);
transmitted_frame_count = get_dword(priv);
received_fragment_count = get_dword(priv);
--
2.17.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/7] staging: ks7010: Remove unnecessary limit checks
2018-05-06 22:02 [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers Nathan Chancellor
2018-05-06 22:02 ` [PATCH 2/7] staging: ks7010: Remove unused variables Nathan Chancellor
@ 2018-05-06 22:03 ` Nathan Chancellor
2018-05-14 13:17 ` Dan Carpenter
2018-05-06 22:03 ` [PATCH 4/7] staging: ks7010: Adjust spacing around functions and declarations Nathan Chancellor
` (4 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: Nathan Chancellor @ 2018-05-06 22:03 UTC (permalink / raw)
To: devel; +Cc: Greg Kroah-Hartman, Nathan Chancellor, linux-kernel
uwrq is an unsigned 32-bit integer, it cannot be less than zero.
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/staging/ks7010/ks_wlan_net.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index e96477937f65..0c83d6fe270f 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -1928,7 +1928,7 @@ static int ks_wlan_set_beacon_lost(struct net_device *dev,
if (priv->sleep_mode == SLP_SLEEP)
return -EPERM;
/* for SLEEP MODE */
- if (*uwrq < BEACON_LOST_COUNT_MIN || *uwrq > BEACON_LOST_COUNT_MAX)
+ if (*uwrq > BEACON_LOST_COUNT_MAX)
return -EINVAL;
priv->reg.beacon_lost_count = *uwrq;
@@ -2133,7 +2133,7 @@ static int ks_wlan_set_tx_gain(struct net_device *dev,
if (priv->sleep_mode == SLP_SLEEP)
return -EPERM;
/* for SLEEP MODE */
- if (*uwrq < 0 || *uwrq > 0xFF)
+ if (*uwrq > 0xFF)
return -EINVAL;
priv->gain.tx_gain = (uint8_t)*uwrq;
@@ -2165,7 +2165,7 @@ static int ks_wlan_set_rx_gain(struct net_device *dev,
if (priv->sleep_mode == SLP_SLEEP)
return -EPERM;
/* for SLEEP MODE */
- if (*uwrq < 0 || *uwrq > 0xFF)
+ if (*uwrq > 0xFF)
return -EINVAL;
priv->gain.rx_gain = (uint8_t)*uwrq;
--
2.17.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 4/7] staging: ks7010: Adjust spacing around functions and declarations
2018-05-06 22:02 [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers Nathan Chancellor
2018-05-06 22:02 ` [PATCH 2/7] staging: ks7010: Remove unused variables Nathan Chancellor
2018-05-06 22:03 ` [PATCH 3/7] staging: ks7010: Remove unnecessary limit checks Nathan Chancellor
@ 2018-05-06 22:03 ` Nathan Chancellor
2018-05-08 11:45 ` Greg Kroah-Hartman
2018-05-06 22:03 ` [PATCH 5/7] staging: ks7010: Remove unnecessary parentheses Nathan Chancellor
` (3 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: Nathan Chancellor @ 2018-05-06 22:03 UTC (permalink / raw)
To: devel; +Cc: Greg Kroah-Hartman, Nathan Chancellor, linux-kernel
checkpatch.pl warns about too many or not enough spaces in these
locations. Adjust them accordingly.
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/staging/ks7010/ks7010_sdio.c | 1 -
drivers/staging/ks7010/ks_hostif.c | 2 +-
drivers/staging/ks7010/michael_mic.c | 1 -
3 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index 6a5565d479ac..e23173a81f24 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -776,7 +776,6 @@ static int ks7010_upload_firmware(struct ks_sdio_card *card)
int ret;
const struct firmware *fw_entry = NULL;
-
sdio_claim_host(card->func);
/* Firmware running ? */
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 4c2f8f710c6e..a2833707e0bf 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -191,7 +191,6 @@ static u8 read_ie(unsigned char *bp, u8 max, u8 *body)
return size;
}
-
static
int get_ap_information(struct ks_wlan_private *priv, struct ap_info *ap_info,
struct local_ap *ap)
@@ -2272,6 +2271,7 @@ void hostif_sme_enqueue(struct ks_wlan_private *priv, unsigned short event)
static inline void hostif_aplist_init(struct ks_wlan_private *priv)
{
size_t size = LOCAL_APLIST_MAX * sizeof(struct local_ap);
+
priv->aplist.size = 0;
memset(&priv->aplist.ap[0], 0, size);
}
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index e6bd70846e98..3acd79615f98 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -11,7 +11,6 @@
#include <linux/string.h>
#include "michael_mic.h"
-
// Reset the state to the empty message.
static inline void michael_clear(struct michael_mic *mic)
{
--
2.17.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 5/7] staging: ks7010: Remove unnecessary parentheses
2018-05-06 22:02 [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers Nathan Chancellor
` (2 preceding siblings ...)
2018-05-06 22:03 ` [PATCH 4/7] staging: ks7010: Adjust spacing around functions and declarations Nathan Chancellor
@ 2018-05-06 22:03 ` Nathan Chancellor
2018-05-08 11:44 ` Greg Kroah-Hartman
2018-05-06 22:03 ` [PATCH 6/7] staging: ks7010: Adjust alignment to open parenthesis Nathan Chancellor
` (2 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: Nathan Chancellor @ 2018-05-06 22:03 UTC (permalink / raw)
To: devel; +Cc: Greg Kroah-Hartman, Nathan Chancellor, linux-kernel
Fixes checkpatch.pl warnings.
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/staging/ks7010/ks_hostif.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index a2833707e0bf..094f8c11b4ab 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -35,7 +35,7 @@ static inline u8 get_byte(struct ks_wlan_private *priv)
{
u8 data;
- data = *(priv->rxp)++;
+ data = *priv->rxp++;
/* length check in advance ! */
--(priv->rx_size);
return data;
@@ -171,7 +171,7 @@ int get_current_ap(struct ks_wlan_private *priv, struct link_ap_info *ap_info)
"- rate_set_size=%d\n",
ap->bssid[0], ap->bssid[1], ap->bssid[2],
ap->bssid[3], ap->bssid[4], ap->bssid[5],
- &(ap->ssid.body[0]),
+ &ap->ssid.body[0],
ap->rate_set.body[0], ap->rate_set.body[1],
ap->rate_set.body[2], ap->rate_set.body[3],
ap->rate_set.body[4], ap->rate_set.body[5],
@@ -734,7 +734,7 @@ void hostif_scan_indication(struct ks_wlan_private *priv)
netdev_dbg(priv->net_dev, " scan_ind_count=%d :: aplist.size=%d\n",
priv->scan_ind_count, priv->aplist.size);
get_ap_information(priv, (struct ap_info *)(priv->rxp),
- &(priv->aplist.ap[priv->scan_ind_count - 1]));
+ &priv->aplist.ap[priv->scan_ind_count - 1]);
priv->aplist.size = priv->scan_ind_count;
} else {
netdev_dbg(priv->net_dev, " count over :: scan_ind_count=%d\n",
--
2.17.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 6/7] staging: ks7010: Adjust alignment to open parenthesis
2018-05-06 22:02 [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers Nathan Chancellor
` (3 preceding siblings ...)
2018-05-06 22:03 ` [PATCH 5/7] staging: ks7010: Remove unnecessary parentheses Nathan Chancellor
@ 2018-05-06 22:03 ` Nathan Chancellor
2018-05-08 11:45 ` Greg Kroah-Hartman
2018-05-06 22:03 ` [PATCH 7/7] staging: ks7010: Move from bool to int in structs Nathan Chancellor
2018-05-08 11:43 ` [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers Greg Kroah-Hartman
6 siblings, 1 reply; 18+ messages in thread
From: Nathan Chancellor @ 2018-05-06 22:03 UTC (permalink / raw)
To: devel; +Cc: Greg Kroah-Hartman, Nathan Chancellor, linux-kernel
Fixes a checkpatch.pl warning.
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/staging/ks7010/ks_hostif.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 094f8c11b4ab..628171091786 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -732,7 +732,7 @@ void hostif_scan_indication(struct ks_wlan_private *priv)
priv->scan_ind_count++;
if (priv->scan_ind_count < LOCAL_APLIST_MAX + 1) {
netdev_dbg(priv->net_dev, " scan_ind_count=%d :: aplist.size=%d\n",
- priv->scan_ind_count, priv->aplist.size);
+ priv->scan_ind_count, priv->aplist.size);
get_ap_information(priv, (struct ap_info *)(priv->rxp),
&priv->aplist.ap[priv->scan_ind_count - 1]);
priv->aplist.size = priv->scan_ind_count;
--
2.17.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 7/7] staging: ks7010: Move from bool to int in structs
2018-05-06 22:02 [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers Nathan Chancellor
` (4 preceding siblings ...)
2018-05-06 22:03 ` [PATCH 6/7] staging: ks7010: Adjust alignment to open parenthesis Nathan Chancellor
@ 2018-05-06 22:03 ` Nathan Chancellor
2018-05-08 11:34 ` Greg Kroah-Hartman
2018-05-08 11:43 ` [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers Greg Kroah-Hartman
6 siblings, 1 reply; 18+ messages in thread
From: Nathan Chancellor @ 2018-05-06 22:03 UTC (permalink / raw)
To: devel; +Cc: Greg Kroah-Hartman, Nathan Chancellor, linux-kernel
Fixes checkpatch.pl warnings.
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/staging/ks7010/ks_hostif.c | 4 ++--
drivers/staging/ks7010/ks_wlan.h | 4 ++--
drivers/staging/ks7010/ks_wlan_net.c | 8 ++++----
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 628171091786..43090922daff 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -475,7 +475,7 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
case DOT11_MAC_ADDRESS:
hostif_sme_enqueue(priv, SME_GET_MAC_ADDRESS);
ether_addr_copy(priv->eth_addr, priv->rxp);
- priv->mac_address_valid = true;
+ priv->mac_address_valid = 1;
ether_addr_copy(dev->dev_addr, priv->eth_addr);
netdev_info(dev, "MAC ADDRESS = %pM\n", priv->eth_addr);
break;
@@ -582,7 +582,7 @@ void hostif_mib_set_confirm(struct ks_wlan_private *priv)
hostif_sme_enqueue(priv, SME_MULTICAST_CONFIRM);
break;
case LOCAL_CURRENTADDRESS:
- priv->mac_address_valid = true;
+ priv->mac_address_valid = 1;
break;
case DOT11_RSN_CONFIG_MULTICAST_CIPHER:
hostif_sme_enqueue(priv, SME_RSN_MCAST_CONFIRM);
diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index 5070af86115f..ffe0e80277c9 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -411,7 +411,7 @@ struct ks_wlan_private {
unsigned int need_commit; /* for ioctl */
/* DeviceIoControl */
- bool is_device_open;
+ int is_device_open;
atomic_t event_count;
atomic_t rec_count;
int dev_count;
@@ -423,7 +423,7 @@ struct ks_wlan_private {
unsigned char firmware_version[128 + 1];
int version_size;
- bool mac_address_valid; /* Mac Address Status */
+ int mac_address_valid; /* Mac Address Status */
int dev_state;
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 0c83d6fe270f..30c03f5d0ec1 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -2504,7 +2504,7 @@ int ks_wlan_set_mac_address(struct net_device *dev, void *addr)
memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len);
memcpy(priv->eth_addr, mac_addr->sa_data, ETH_ALEN);
- priv->mac_address_valid = false;
+ priv->mac_address_valid = 0;
hostif_sme_enqueue(priv, SME_MACADDRESS_SET_REQUEST);
netdev_info(dev, "ks_wlan: MAC ADDRESS = %pM\n", priv->eth_addr);
return 0;
@@ -2627,8 +2627,8 @@ int ks_wlan_net_start(struct net_device *dev)
/* int rc; */
priv = netdev_priv(dev);
- priv->mac_address_valid = false;
- priv->is_device_open = true;
+ priv->mac_address_valid = 0;
+ priv->is_device_open = 1;
priv->need_commit = 0;
/* phy information update timer */
atomic_set(&update_phyinfo, 0);
@@ -2652,7 +2652,7 @@ int ks_wlan_net_stop(struct net_device *dev)
{
struct ks_wlan_private *priv = netdev_priv(dev);
- priv->is_device_open = false;
+ priv->is_device_open = 0;
del_timer_sync(&update_phyinfo_timer);
if (netif_running(dev))
--
2.17.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 2/7] staging: ks7010: Remove unused variables
2018-05-06 22:02 ` [PATCH 2/7] staging: ks7010: Remove unused variables Nathan Chancellor
@ 2018-05-07 17:59 ` Nathan Chancellor
0 siblings, 0 replies; 18+ messages in thread
From: Nathan Chancellor @ 2018-05-07 17:59 UTC (permalink / raw)
To: devel; +Cc: Greg Kroah-Hartman, linux-kernel
On Sun, May 06, 2018 at 03:02:59PM -0700, Nathan Chancellor wrote:
> GCC warns these variables are all set but never used so remove them.
>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/staging/ks7010/ks_hostif.c | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
> index c0a9a67dc0b4..4c2f8f710c6e 100644
> --- a/drivers/staging/ks7010/ks_hostif.c
> +++ b/drivers/staging/ks7010/ks_hostif.c
> @@ -354,7 +354,6 @@ void hostif_data_indication(struct ks_wlan_private *priv)
> unsigned short auth_type;
> unsigned char temp[256];
> struct ether_hdr *eth_hdr;
> - unsigned short eth_proto;
> struct ieee802_1x_hdr *aa1x_hdr;
> size_t size;
> int ret;
> @@ -369,7 +368,6 @@ void hostif_data_indication(struct ks_wlan_private *priv)
> get_word(priv); /* Reserve Area */
>
> eth_hdr = (struct ether_hdr *)(priv->rxp);
> - eth_proto = ntohs(eth_hdr->h_proto);
>
> /* source address check */
> if (ether_addr_equal(&priv->eth_addr[0], eth_hdr->h_source)) {
> @@ -464,13 +462,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
> struct net_device *dev = priv->net_dev;
> u32 mib_status;
> u32 mib_attribute;
> - u16 mib_val_size;
> - u16 mib_val_type;
>
> mib_status = get_dword(priv); /* MIB status */
> mib_attribute = get_dword(priv); /* MIB atttibute */
> - mib_val_size = get_word(priv); /* MIB value size */
> - mib_val_type = get_word(priv); /* MIB value type */
>
> if (mib_status) {
> netdev_err(priv->net_dev, "attribute=%08X, status=%08X\n",
> @@ -792,9 +786,6 @@ void hostif_ps_adhoc_set_confirm(struct ks_wlan_private *priv)
> static
> void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv)
> {
> - u16 result_code;
> -
> - result_code = get_word(priv);
> priv->infra_status = 1; /* infrastructure mode set */
> hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM);
> }
> @@ -872,14 +863,13 @@ static
> void hostif_phy_information_confirm(struct ks_wlan_private *priv)
> {
> struct iw_statistics *wstats = &priv->wstats;
> - unsigned char rssi, signal, noise;
> + unsigned char rssi, signal;
> unsigned char link_speed;
> unsigned int transmitted_frame_count, received_fragment_count;
> unsigned int failed_count, fcs_error_count;
>
> rssi = get_byte(priv);
> signal = get_byte(priv);
> - noise = get_byte(priv);
> link_speed = get_byte(priv);
> transmitted_frame_count = get_dword(priv);
> received_fragment_count = get_dword(priv);
> --
> 2.17.0
>
On second glance, I did not realize most of these functions involve
pointer semantics. Please do not apply this. I can send a v2 series if
necessary although every other patch is fine.
Thanks,
Nathan
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 7/7] staging: ks7010: Move from bool to int in structs
2018-05-06 22:03 ` [PATCH 7/7] staging: ks7010: Move from bool to int in structs Nathan Chancellor
@ 2018-05-08 11:34 ` Greg Kroah-Hartman
2018-05-08 11:42 ` Nathan Chancellor
0 siblings, 1 reply; 18+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-08 11:34 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: devel, linux-kernel
On Sun, May 06, 2018 at 03:03:04PM -0700, Nathan Chancellor wrote:
> Fixes checkpatch.pl warnings.
>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/staging/ks7010/ks_hostif.c | 4 ++--
> drivers/staging/ks7010/ks_wlan.h | 4 ++--
> drivers/staging/ks7010/ks_wlan_net.c | 8 ++++----
> 3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
> index 628171091786..43090922daff 100644
> --- a/drivers/staging/ks7010/ks_hostif.c
> +++ b/drivers/staging/ks7010/ks_hostif.c
> @@ -475,7 +475,7 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
> case DOT11_MAC_ADDRESS:
> hostif_sme_enqueue(priv, SME_GET_MAC_ADDRESS);
> ether_addr_copy(priv->eth_addr, priv->rxp);
> - priv->mac_address_valid = true;
> + priv->mac_address_valid = 1;
Wait, why? This should be bool, not an int. Why would checkpatch say
this is incorrect?
confused,
greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 7/7] staging: ks7010: Move from bool to int in structs
2018-05-08 11:34 ` Greg Kroah-Hartman
@ 2018-05-08 11:42 ` Nathan Chancellor
0 siblings, 0 replies; 18+ messages in thread
From: Nathan Chancellor @ 2018-05-08 11:42 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: devel, linux-kernel
On Tue, May 08, 2018 at 01:34:31PM +0200, Greg Kroah-Hartman wrote:
> On Sun, May 06, 2018 at 03:03:04PM -0700, Nathan Chancellor wrote:
> > Fixes checkpatch.pl warnings.
> >
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> > drivers/staging/ks7010/ks_hostif.c | 4 ++--
> > drivers/staging/ks7010/ks_wlan.h | 4 ++--
> > drivers/staging/ks7010/ks_wlan_net.c | 8 ++++----
> > 3 files changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
> > index 628171091786..43090922daff 100644
> > --- a/drivers/staging/ks7010/ks_hostif.c
> > +++ b/drivers/staging/ks7010/ks_hostif.c
> > @@ -475,7 +475,7 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
> > case DOT11_MAC_ADDRESS:
> > hostif_sme_enqueue(priv, SME_GET_MAC_ADDRESS);
> > ether_addr_copy(priv->eth_addr, priv->rxp);
> > - priv->mac_address_valid = true;
> > + priv->mac_address_valid = 1;
>
> Wait, why? This should be bool, not an int. Why would checkpatch say
> this is incorrect?
>
> confused,
>
> greg k-h
CHECK: Avoid using bool structure members because of possible alignment issues - see: https://lkml.org/lkml/2017/11/21/384
#417: FILE: drivers/staging/ks7010/ks_wlan.h:417:
+ bool is_device_open;
Introduced by commit a4c4c0492dad ("checkpatch: add a --strict test for
structs with bool member definitions"). If this is wrong, please feel
free to ignore it!
Thanks,
Nathan
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers
2018-05-06 22:02 [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers Nathan Chancellor
` (5 preceding siblings ...)
2018-05-06 22:03 ` [PATCH 7/7] staging: ks7010: Move from bool to int in structs Nathan Chancellor
@ 2018-05-08 11:43 ` Greg Kroah-Hartman
2018-05-08 11:49 ` Nathan Chancellor
6 siblings, 1 reply; 18+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-08 11:43 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: devel, linux-kernel
On Sun, May 06, 2018 at 03:02:58PM -0700, Nathan Chancellor wrote:
> This satisfies a checkpatch.pl warning and is the preferred method for
> notating the license due to its lack of ambiguity.
>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/staging/ks7010/ks7010_sdio.c | 5 +----
> drivers/staging/ks7010/ks7010_sdio.h | 5 +----
> drivers/staging/ks7010/ks_hostif.c | 5 +----
> drivers/staging/ks7010/ks_hostif.h | 5 +----
> drivers/staging/ks7010/ks_wlan.h | 5 +----
> drivers/staging/ks7010/ks_wlan_ioctl.h | 5 +----
> drivers/staging/ks7010/ks_wlan_net.c | 5 +----
> drivers/staging/ks7010/michael_mic.c | 5 +----
> drivers/staging/ks7010/michael_mic.h | 5 +----
> 9 files changed, 9 insertions(+), 36 deletions(-)
This patch does not apply to my staging.git tree :(
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 5/7] staging: ks7010: Remove unnecessary parentheses
2018-05-06 22:03 ` [PATCH 5/7] staging: ks7010: Remove unnecessary parentheses Nathan Chancellor
@ 2018-05-08 11:44 ` Greg Kroah-Hartman
0 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-08 11:44 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: devel, linux-kernel
On Sun, May 06, 2018 at 03:03:02PM -0700, Nathan Chancellor wrote:
> Fixes checkpatch.pl warnings.
>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/staging/ks7010/ks_hostif.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
> index a2833707e0bf..094f8c11b4ab 100644
> --- a/drivers/staging/ks7010/ks_hostif.c
> +++ b/drivers/staging/ks7010/ks_hostif.c
> @@ -35,7 +35,7 @@ static inline u8 get_byte(struct ks_wlan_private *priv)
> {
> u8 data;
>
> - data = *(priv->rxp)++;
> + data = *priv->rxp++;
Ick, no, the original is correct here. The changed one is now harder to
read, I have to go look up order of operations here to figure this out
:(
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 4/7] staging: ks7010: Adjust spacing around functions and declarations
2018-05-06 22:03 ` [PATCH 4/7] staging: ks7010: Adjust spacing around functions and declarations Nathan Chancellor
@ 2018-05-08 11:45 ` Greg Kroah-Hartman
0 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-08 11:45 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: devel, linux-kernel
On Sun, May 06, 2018 at 03:03:01PM -0700, Nathan Chancellor wrote:
> checkpatch.pl warns about too many or not enough spaces in these
> locations. Adjust them accordingly.
>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/staging/ks7010/ks7010_sdio.c | 1 -
> drivers/staging/ks7010/ks_hostif.c | 2 +-
> drivers/staging/ks7010/michael_mic.c | 1 -
> 3 files changed, 1 insertion(+), 3 deletions(-)
Doesn't apply to my tree :(
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 6/7] staging: ks7010: Adjust alignment to open parenthesis
2018-05-06 22:03 ` [PATCH 6/7] staging: ks7010: Adjust alignment to open parenthesis Nathan Chancellor
@ 2018-05-08 11:45 ` Greg Kroah-Hartman
0 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-08 11:45 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: devel, linux-kernel
On Sun, May 06, 2018 at 03:03:03PM -0700, Nathan Chancellor wrote:
> Fixes a checkpatch.pl warning.
>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/staging/ks7010/ks_hostif.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Also does not apply :(
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers
2018-05-08 11:43 ` [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers Greg Kroah-Hartman
@ 2018-05-08 11:49 ` Nathan Chancellor
0 siblings, 0 replies; 18+ messages in thread
From: Nathan Chancellor @ 2018-05-08 11:49 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: devel, linux-kernel
On Tue, May 08, 2018 at 01:43:13PM +0200, Greg Kroah-Hartman wrote:
> On Sun, May 06, 2018 at 03:02:58PM -0700, Nathan Chancellor wrote:
> > This satisfies a checkpatch.pl warning and is the preferred method for
> > notating the license due to its lack of ambiguity.
> >
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> > drivers/staging/ks7010/ks7010_sdio.c | 5 +----
> > drivers/staging/ks7010/ks7010_sdio.h | 5 +----
> > drivers/staging/ks7010/ks_hostif.c | 5 +----
> > drivers/staging/ks7010/ks_hostif.h | 5 +----
> > drivers/staging/ks7010/ks_wlan.h | 5 +----
> > drivers/staging/ks7010/ks_wlan_ioctl.h | 5 +----
> > drivers/staging/ks7010/ks_wlan_net.c | 5 +----
> > drivers/staging/ks7010/michael_mic.c | 5 +----
> > drivers/staging/ks7010/michael_mic.h | 5 +----
> > 9 files changed, 9 insertions(+), 36 deletions(-)
>
> This patch does not apply to my staging.git tree :(
Looks like someone beat me to most if not all of my patches (they
weren't pushed out when I did these on Sunday). I will take a look
later today to see if any of them are still relevant.
Thanks!
Nathan
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/7] staging: ks7010: Remove unnecessary limit checks
2018-05-06 22:03 ` [PATCH 3/7] staging: ks7010: Remove unnecessary limit checks Nathan Chancellor
@ 2018-05-14 13:17 ` Dan Carpenter
2018-05-14 14:06 ` Nathan Chancellor
0 siblings, 1 reply; 18+ messages in thread
From: Dan Carpenter @ 2018-05-14 13:17 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: devel, Greg Kroah-Hartman, linux-kernel
On Sun, May 06, 2018 at 03:03:00PM -0700, Nathan Chancellor wrote:
> uwrq is an unsigned 32-bit integer, it cannot be less than zero.
>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/staging/ks7010/ks_wlan_net.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
> index e96477937f65..0c83d6fe270f 100644
> --- a/drivers/staging/ks7010/ks_wlan_net.c
> +++ b/drivers/staging/ks7010/ks_wlan_net.c
> @@ -1928,7 +1928,7 @@ static int ks_wlan_set_beacon_lost(struct net_device *dev,
> if (priv->sleep_mode == SLP_SLEEP)
> return -EPERM;
> /* for SLEEP MODE */
> - if (*uwrq < BEACON_LOST_COUNT_MIN || *uwrq > BEACON_LOST_COUNT_MAX)
> + if (*uwrq > BEACON_LOST_COUNT_MAX)
I believe Smatch is supposed to ignore this sort of code because
comparing "if (foo < 0 || foo > max) " is pretty readable and idiomatic.
Presumably this was so we could redefine BEACON_LOST_COUNT_MIN, but it's
fine to unused code. The define isn't needed at all, so you can
delete that as well.
regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/7] staging: ks7010: Remove unnecessary limit checks
2018-05-14 13:17 ` Dan Carpenter
@ 2018-05-14 14:06 ` Nathan Chancellor
2018-05-14 14:15 ` Dan Carpenter
0 siblings, 1 reply; 18+ messages in thread
From: Nathan Chancellor @ 2018-05-14 14:06 UTC (permalink / raw)
To: Dan Carpenter; +Cc: devel, Greg Kroah-Hartman, linux-kernel
On Mon, May 14, 2018 at 04:17:36PM +0300, Dan Carpenter wrote:
> On Sun, May 06, 2018 at 03:03:00PM -0700, Nathan Chancellor wrote:
> > uwrq is an unsigned 32-bit integer, it cannot be less than zero.
> >
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> > drivers/staging/ks7010/ks_wlan_net.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
> > index e96477937f65..0c83d6fe270f 100644
> > --- a/drivers/staging/ks7010/ks_wlan_net.c
> > +++ b/drivers/staging/ks7010/ks_wlan_net.c
> > @@ -1928,7 +1928,7 @@ static int ks_wlan_set_beacon_lost(struct net_device *dev,
> > if (priv->sleep_mode == SLP_SLEEP)
> > return -EPERM;
> > /* for SLEEP MODE */
> > - if (*uwrq < BEACON_LOST_COUNT_MIN || *uwrq > BEACON_LOST_COUNT_MAX)
> > + if (*uwrq > BEACON_LOST_COUNT_MAX)
>
> I believe Smatch is supposed to ignore this sort of code because
> comparing "if (foo < 0 || foo > max) " is pretty readable and idiomatic.
>
> Presumably this was so we could redefine BEACON_LOST_COUNT_MIN, but it's
> fine to unused code. The define isn't needed at all, so you can
> delete that as well.
>
> regards,
> dan carpenter
>
Hi Dan,
Thanks for the suggestion, I just sent a patch.
This warning came from GCC as a -Wtype-limit warning. I should have put
that in the commit message to be more clear. I will keep this in mind
for the future if I come across any more checks like this with defines.
Thanks!
Nathan Chancellor
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/7] staging: ks7010: Remove unnecessary limit checks
2018-05-14 14:06 ` Nathan Chancellor
@ 2018-05-14 14:15 ` Dan Carpenter
0 siblings, 0 replies; 18+ messages in thread
From: Dan Carpenter @ 2018-05-14 14:15 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: devel, Greg Kroah-Hartman, linux-kernel
On Mon, May 14, 2018 at 07:06:22AM -0700, Nathan Chancellor wrote:
> On Mon, May 14, 2018 at 04:17:36PM +0300, Dan Carpenter wrote:
> > On Sun, May 06, 2018 at 03:03:00PM -0700, Nathan Chancellor wrote:
> > > uwrq is an unsigned 32-bit integer, it cannot be less than zero.
> > >
> > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > > ---
> > > drivers/staging/ks7010/ks_wlan_net.c | 6 +++---
> > > 1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
> > > index e96477937f65..0c83d6fe270f 100644
> > > --- a/drivers/staging/ks7010/ks_wlan_net.c
> > > +++ b/drivers/staging/ks7010/ks_wlan_net.c
> > > @@ -1928,7 +1928,7 @@ static int ks_wlan_set_beacon_lost(struct net_device *dev,
> > > if (priv->sleep_mode == SLP_SLEEP)
> > > return -EPERM;
> > > /* for SLEEP MODE */
> > > - if (*uwrq < BEACON_LOST_COUNT_MIN || *uwrq > BEACON_LOST_COUNT_MAX)
> > > + if (*uwrq > BEACON_LOST_COUNT_MAX)
> >
> > I believe Smatch is supposed to ignore this sort of code because
> > comparing "if (foo < 0 || foo > max) " is pretty readable and idiomatic.
> >
> > Presumably this was so we could redefine BEACON_LOST_COUNT_MIN, but it's
> > fine to unused code. The define isn't needed at all, so you can
> > delete that as well.
> >
> > regards,
> > dan carpenter
> >
>
> Hi Dan,
>
> Thanks for the suggestion, I just sent a patch.
>
> This warning came from GCC as a -Wtype-limit warning. I should have put
> that in the commit message to be more clear. I will keep this in mind
> for the future if I come across any more checks like this with defines.
>
Anyway, please delete BEACON_LOST_COUNT_MIN entirely.
regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2018-05-14 14:15 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-06 22:02 [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers Nathan Chancellor
2018-05-06 22:02 ` [PATCH 2/7] staging: ks7010: Remove unused variables Nathan Chancellor
2018-05-07 17:59 ` Nathan Chancellor
2018-05-06 22:03 ` [PATCH 3/7] staging: ks7010: Remove unnecessary limit checks Nathan Chancellor
2018-05-14 13:17 ` Dan Carpenter
2018-05-14 14:06 ` Nathan Chancellor
2018-05-14 14:15 ` Dan Carpenter
2018-05-06 22:03 ` [PATCH 4/7] staging: ks7010: Adjust spacing around functions and declarations Nathan Chancellor
2018-05-08 11:45 ` Greg Kroah-Hartman
2018-05-06 22:03 ` [PATCH 5/7] staging: ks7010: Remove unnecessary parentheses Nathan Chancellor
2018-05-08 11:44 ` Greg Kroah-Hartman
2018-05-06 22:03 ` [PATCH 6/7] staging: ks7010: Adjust alignment to open parenthesis Nathan Chancellor
2018-05-08 11:45 ` Greg Kroah-Hartman
2018-05-06 22:03 ` [PATCH 7/7] staging: ks7010: Move from bool to int in structs Nathan Chancellor
2018-05-08 11:34 ` Greg Kroah-Hartman
2018-05-08 11:42 ` Nathan Chancellor
2018-05-08 11:43 ` [PATCH 1/7] staging: ks7010: Replace license boilerplate with SPDX identifiers Greg Kroah-Hartman
2018-05-08 11:49 ` Nathan Chancellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).