mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Larry Finger <Larry.Finger@lwfinger.net>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: [PATCH 1/2] staging: rtl8821ae: Pass large struct by const reference
Date: Tue,  1 Jul 2014 12:25:44 +0200	[thread overview]
Message-ID: <1404210345-28181-1-git-send-email-linux@rasmusvillemoes.dk> (raw)

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


             reply	other threads:[~2014-07-01 10:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-01 10:25 Rasmus Villemoes [this message]
2014-07-01 10:25 ` [PATCH 2/2] staging: rtl8192ee: " Rasmus Villemoes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404210345-28181-1-git-send-email-linux@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=Larry.Finger@lwfinger.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®