DPDK patches and discussions
 help / color / mirror / Atom feed
From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 07/15] i40e: Get rid of sparse warnings, and remove unreachable code
Date: Tue,  9 Sep 2014 15:21:31 +0800
Message-ID: <1410247299-4365-8-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1410247299-4365-1-git-send-email-helin.zhang@intel.com>

There are variables that represent values in little endian.
Adding prefix of '__Le' can remove warnings during sparse
checks. In addition, remove some unreachable 'break' statements,
and add 'UL' on a couple of constants.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
---
 lib/librte_pmd_i40e/i40e/i40e_lan_hmc.c | 24 ++++++++++++++----------
 lib/librte_pmd_i40e/i40e/i40e_lan_hmc.h |  1 -
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.c b/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.c
index 9f98d6d..b08534b 100644
--- a/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.c
+++ b/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.c
@@ -424,7 +424,6 @@ enum i40e_status_code i40e_create_lan_hmc_object(struct i40e_hw *hw,
 			default:
 				ret_code = I40E_ERR_INVALID_SD_TYPE;
 				goto exit;
-				break;
 			}
 		}
 	}
@@ -509,7 +508,6 @@ try_type_paged:
 		DEBUGOUT1("i40e_configure_lan_hmc: Unknown SD type: %d\n",
 			  ret_code);
 		goto configure_lan_hmc_out;
-		break;
 	}
 
 	/* Configure and program the FPM registers so objects can be created */
@@ -803,9 +801,10 @@ static void i40e_write_word(u8 *hmc_bits,
 			    struct i40e_context_ele *ce_info,
 			    u8 *src)
 {
-	u16 src_word, dest_word, mask;
+	u16 src_word, mask;
 	u8 *from, *dest;
 	u16 shift_width;
+	__le16 dest_word;
 
 	/* copy from the next struct field */
 	from = src + ce_info->offset;
@@ -846,9 +845,10 @@ static void i40e_write_dword(u8 *hmc_bits,
 			     struct i40e_context_ele *ce_info,
 			     u8 *src)
 {
-	u32 src_dword, dest_dword, mask;
+	u32 src_dword, mask;
 	u8 *from, *dest;
 	u16 shift_width;
+	__le32 dest_dword;
 
 	/* copy from the next struct field */
 	from = src + ce_info->offset;
@@ -897,9 +897,10 @@ static void i40e_write_qword(u8 *hmc_bits,
 			     struct i40e_context_ele *ce_info,
 			     u8 *src)
 {
-	u64 src_qword, dest_qword, mask;
+	u64 src_qword, mask;
 	u8 *from, *dest;
 	u16 shift_width;
+	__le64 dest_qword;
 
 	/* copy from the next struct field */
 	from = src + ce_info->offset;
@@ -914,7 +915,7 @@ static void i40e_write_qword(u8 *hmc_bits,
 	if (ce_info->width < 64)
 		mask = ((u64)1 << ce_info->width) - 1;
 	else
-		mask = 0xFFFFFFFFFFFFFFFF;
+		mask = 0xFFFFFFFFFFFFFFFFUL;
 
 	/* don't swizzle the bits until after the mask because the mask bits
 	 * will be in a different bit position on big endian machines
@@ -985,9 +986,10 @@ static void i40e_read_word(u8 *hmc_bits,
 			   struct i40e_context_ele *ce_info,
 			   u8 *dest)
 {
-	u16 src_word, dest_word, mask;
+	u16 dest_word, mask;
 	u8 *src, *target;
 	u16 shift_width;
+	__le16 src_word;
 
 	/* prepare the bits and mask */
 	shift_width = ce_info->lsb % 8;
@@ -1028,9 +1030,10 @@ static void i40e_read_dword(u8 *hmc_bits,
 			    struct i40e_context_ele *ce_info,
 			    u8 *dest)
 {
-	u32 src_dword, dest_dword, mask;
+	u32 dest_dword, mask;
 	u8 *src, *target;
 	u16 shift_width;
+	__le32 src_dword;
 
 	/* prepare the bits and mask */
 	shift_width = ce_info->lsb % 8;
@@ -1080,9 +1083,10 @@ static void i40e_read_qword(u8 *hmc_bits,
 			    struct i40e_context_ele *ce_info,
 			    u8 *dest)
 {
-	u64 src_qword, dest_qword, mask;
+	u64 dest_qword, mask;
 	u8 *src, *target;
 	u16 shift_width;
+	__le64 src_qword;
 
 	/* prepare the bits and mask */
 	shift_width = ce_info->lsb % 8;
@@ -1094,7 +1098,7 @@ static void i40e_read_qword(u8 *hmc_bits,
 	if (ce_info->width < 64)
 		mask = ((u64)1 << ce_info->width) - 1;
 	else
-		mask = 0xFFFFFFFFFFFFFFFF;
+		mask = 0xFFFFFFFFFFFFFFFFUL;
 
 	/* shift to correct alignment */
 	mask <<= shift_width;
diff --git a/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.h b/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.h
index f0f0f89..70ef65c 100644
--- a/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.h
+++ b/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.h
@@ -36,7 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
 
 /* forward-declare the HW struct for the compiler */
 struct i40e_hw;
-enum i40e_status_code;
 
 /* HMC element context information */
 
-- 
1.8.1.4

  parent reply	other threads:[~2014-09-09  7:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09  7:21 [dpdk-dev] [PATCH 00/15] i40e base driver udpate Helin Zhang
2014-09-09  7:21 ` [dpdk-dev] [PATCH 01/15] i40e: make the indentation more consistent in share code Helin Zhang
2014-09-09  7:21 ` [dpdk-dev] [PATCH 02/15] i40e: support nvmupdate by default Helin Zhang
2014-09-09  7:21 ` [dpdk-dev] [PATCH 03/15] i40e: remove useless code which was written for Solaris Helin Zhang
2014-09-09  7:21 ` [dpdk-dev] [PATCH 04/15] i40e: remove test code for 'ethtool' Helin Zhang
2014-09-09  7:21 ` [dpdk-dev] [PATCH 05/15] i40e: force a shifted '1' to be 'unsigned' Helin Zhang
2014-09-09  7:21 ` [dpdk-dev] [PATCH 06/15] i40e: remove useless code for pre-boot support Helin Zhang
2014-09-09  7:21 ` Helin Zhang [this message]
2014-09-09  7:21 ` [dpdk-dev] [PATCH 08/15] i40e: remove code which is for software validation only Helin Zhang
2014-09-09  7:21 ` [dpdk-dev] [PATCH 09/15] i40e: remove code for TPH (TLP Processing Hints) Helin Zhang
2014-09-09  7:21 ` [dpdk-dev] [PATCH 10/15] i40e: support of 10G base T Helin Zhang
2014-09-09  7:21 ` [dpdk-dev] [PATCH 11/15] i40e: expose debug_write_register request Helin Zhang
2014-09-09  7:21 ` [dpdk-dev] [PATCH 12/15] i40e: workaround of get_firmware_version, and enhancements Helin Zhang
2014-09-09  7:21 ` [dpdk-dev] [PATCH 13/15] i40e: Use get_link_status to report FC settings Helin Zhang
2014-09-09  7:21 ` [dpdk-dev] [PATCH 14/15] i40e: fix and enhancement in arq_event_info struct Helin Zhang
2014-09-09  7:21 ` [dpdk-dev] [PATCH 15/15] i40e: support redefined struct of 'i40e_arq_event_info' Helin Zhang
2014-09-29  2:59 ` [dpdk-dev] [PATCH 00/15] i40e base driver update Xu, HuilongX
2014-10-07 16:31 ` [dpdk-dev] [PATCH 00/15] i40e base driver udpate Thomas Monjalon

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=1410247299-4365-8-git-send-email-helin.zhang@intel.com \
    --to=helin.zhang@intel.com \
    --cc=dev@dpdk.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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git