* [PATCH 1/2] staging: rtl8821ae: Pass large struct by const reference
@ 2014-07-01 10:25 Rasmus Villemoes
2014-07-01 10:25 ` [PATCH 2/2] staging: rtl8192ee: " Rasmus Villemoes
0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Villemoes @ 2014-07-01 10:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Larry Finger; +Cc: devel, linux-kernel, Rasmus Villemoes
struct rtl_stats is rather huge (152 bytes), and since
rtl8812ae_rx_command_packet_handler() does not modify it, it might as
well be passed by const reference.
Reported by Coverity: CID 1167285
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/staging/rtl8821ae/pci.c | 2 +-
drivers/staging/rtl8821ae/rtl8821ae/sw.c | 4 ++--
drivers/staging/rtl8821ae/wifi.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/rtl8821ae/pci.c b/drivers/staging/rtl8821ae/pci.c
index e194ffe..f9847d1 100644
--- a/drivers/staging/rtl8821ae/pci.c
+++ b/drivers/staging/rtl8821ae/pci.c
@@ -861,7 +861,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
break;
}
- rtlpriv->cfg->ops->rx_command_packet_handler(hw, status, skb);
+ rtlpriv->cfg->ops->rx_command_packet_handler(hw, &status, skb);
/*
*NOTICE This can not be use for mac80211,
diff --git a/drivers/staging/rtl8821ae/rtl8821ae/sw.c b/drivers/staging/rtl8821ae/rtl8821ae/sw.c
index 2621275..115002f 100644
--- a/drivers/staging/rtl8821ae/rtl8821ae/sw.c
+++ b/drivers/staging/rtl8821ae/rtl8821ae/sw.c
@@ -227,14 +227,14 @@ void rtl8821ae_deinit_sw_vars(struct ieee80211_hw *hw)
static u32 rtl8812ae_rx_command_packet_handler(
struct ieee80211_hw *hw,
- struct rtl_stats status,
+ const struct rtl_stats *status,
struct sk_buff *skb
)
{
u32 result = 0;
struct rtl_priv *rtlpriv = rtl_priv(hw);
- switch (status.packet_report_type) {
+ switch (status->packet_report_type) {
case NORMAL_RX:
result = 0;
break;
diff --git a/drivers/staging/rtl8821ae/wifi.h b/drivers/staging/rtl8821ae/wifi.h
index e8250da..218cd44 100644
--- a/drivers/staging/rtl8821ae/wifi.h
+++ b/drivers/staging/rtl8821ae/wifi.h
@@ -1853,7 +1853,7 @@ struct rtl_hal_ops {
u32 cmd_len, u8 *p_cmdbuffer);
bool (*get_btc_status)(void);
u32 (*rx_command_packet_handler)(struct ieee80211_hw *hw,
- struct rtl_stats status,
+ const struct rtl_stats *status,
struct sk_buff *skb);
};
--
1.9.2
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH 2/2] staging: rtl8192ee: Pass large struct by const reference
2014-07-01 10:25 [PATCH 1/2] staging: rtl8821ae: Pass large struct by const reference Rasmus Villemoes
@ 2014-07-01 10:25 ` Rasmus Villemoes
0 siblings, 0 replies; 2+ messages in thread
From: Rasmus Villemoes @ 2014-07-01 10:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Larry Finger; +Cc: devel, linux-kernel, Rasmus Villemoes
struct rtl_stats is rather huge (152 bytes), and since
rtl92ee_rx_command_packet() does not modify it, it might as
well be passed by const reference.
Reported by Coverity: CID 1222131
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/staging/rtl8192ee/pci.c | 2 +-
drivers/staging/rtl8192ee/rtl8192ee/trx.c | 4 ++--
drivers/staging/rtl8192ee/rtl8192ee/trx.h | 2 +-
drivers/staging/rtl8192ee/wifi.h | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/rtl8192ee/pci.c b/drivers/staging/rtl8192ee/pci.c
index 3fe9b7b..f3abbcc 100644
--- a/drivers/staging/rtl8192ee/pci.c
+++ b/drivers/staging/rtl8192ee/pci.c
@@ -892,7 +892,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
}
/* handle command packet here */
- if (rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) {
+ if (rtlpriv->cfg->ops->rx_command_packet(hw, &stats, skb)) {
dev_kfree_skb_any(skb);
goto end;
}
diff --git a/drivers/staging/rtl8192ee/rtl8192ee/trx.c b/drivers/staging/rtl8192ee/rtl8192ee/trx.c
index c930f52..1190c8b 100644
--- a/drivers/staging/rtl8192ee/rtl8192ee/trx.c
+++ b/drivers/staging/rtl8192ee/rtl8192ee/trx.c
@@ -1263,13 +1263,13 @@ bool rtl92ee_is_tx_desc_closed(struct ieee80211_hw *hw, u8 hw_queue, u16 index)
}
u32 rtl92ee_rx_command_packet(struct ieee80211_hw *hw,
- struct rtl_stats status,
+ const struct rtl_stats *status,
struct sk_buff *skb)
{
u32 result = 0;
struct rtl_priv *rtlpriv = rtl_priv(hw);
- switch (status.packet_report_type) {
+ switch (status->packet_report_type) {
case NORMAL_RX:
result = 0;
break;
diff --git a/drivers/staging/rtl8192ee/rtl8192ee/trx.h b/drivers/staging/rtl8192ee/rtl8192ee/trx.h
index c2cd581..e04ee7e 100644
--- a/drivers/staging/rtl8192ee/rtl8192ee/trx.h
+++ b/drivers/staging/rtl8192ee/rtl8192ee/trx.h
@@ -872,6 +872,6 @@ void rtl92ee_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
bool b_firstseg, bool b_lastseg,
struct sk_buff *skb);
u32 rtl92ee_rx_command_packet(struct ieee80211_hw *hw,
- struct rtl_stats status,
+ const struct rtl_stats *status,
struct sk_buff *skb);
#endif
diff --git a/drivers/staging/rtl8192ee/wifi.h b/drivers/staging/rtl8192ee/wifi.h
index 96fa261..a37176a 100644
--- a/drivers/staging/rtl8192ee/wifi.h
+++ b/drivers/staging/rtl8192ee/wifi.h
@@ -1946,7 +1946,7 @@ struct rtl_hal_ops {
u32 cmd_len, u8 *p_cmdbuffer);
bool (*get_btc_status)(void);
u32 (*rx_command_packet)(struct ieee80211_hw *hw,
- struct rtl_stats status, struct sk_buff *skb);
+ const struct rtl_stats *status, struct sk_buff *skb);
void (*add_wowlan_pattern)(struct ieee80211_hw *hw,
struct rtl_wow_pattern *rtl_pattern,
u8 index);
--
1.9.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-01 10:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-01 10:25 [PATCH 1/2] staging: rtl8821ae: Pass large struct by const reference Rasmus Villemoes
2014-07-01 10:25 ` [PATCH 2/2] staging: rtl8192ee: " Rasmus Villemoes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®