From 0ab1d25fc4a3ec043bef63662618c83934f819c0 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Fri, 23 Nov 2018 10:21:50 +0000 Subject: [PATCH] sfxge(4): remove duplicate NVRAM asserts The checking performed in the ->envo_type_to_partn internal method make these assertions unnecessary. Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. Differential Revision: https://reviews.freebsd.org/D18094 --- sys/dev/sfxge/common/ef10_nvram.c | 1 + sys/dev/sfxge/common/efx_nvram.c | 27 --------------------------- sys/dev/sfxge/common/siena_nvram.c | 1 + 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/sys/dev/sfxge/common/ef10_nvram.c b/sys/dev/sfxge/common/ef10_nvram.c index 864aa488632..29fd6bb4567 100644 --- a/sys/dev/sfxge/common/ef10_nvram.c +++ b/sys/dev/sfxge/common/ef10_nvram.c @@ -2210,6 +2210,7 @@ ef10_nvram_type_to_partn( size_t parttbl_rows = 0; unsigned int i; + EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID); EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); EFSYS_ASSERT(partnp != NULL); diff --git a/sys/dev/sfxge/common/efx_nvram.c b/sys/dev/sfxge/common/efx_nvram.c index c55d60f58c3..b71ae448fea 100644 --- a/sys/dev/sfxge/common/efx_nvram.c +++ b/sys/dev/sfxge/common/efx_nvram.c @@ -167,8 +167,6 @@ efx_nvram_size( EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM); - EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); - if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0) goto fail1; @@ -201,8 +199,6 @@ efx_nvram_get_version( EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM); - EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); - if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0) goto fail1; @@ -233,9 +229,6 @@ efx_nvram_rw_start( EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM); - EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); - EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID); - if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0) goto fail1; @@ -271,9 +264,6 @@ efx_nvram_read_chunk( EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM); - EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); - EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID); - if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0) goto fail1; @@ -312,9 +302,6 @@ efx_nvram_read_backup( EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM); - EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); - EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID); - if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0) goto fail1; @@ -348,9 +335,6 @@ efx_nvram_erase( EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM); - EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); - EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID); - if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0) goto fail1; @@ -389,9 +373,6 @@ efx_nvram_write_chunk( EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM); - EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); - EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID); - if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0) goto fail1; @@ -424,9 +405,6 @@ efx_nvram_rw_finish( EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM); - EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); - EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID); - if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0) goto fail1; @@ -470,8 +448,6 @@ efx_nvram_set_version( EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM); - EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); - if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0) goto fail1; @@ -511,9 +487,6 @@ efx_nvram_validate( EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM); - EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); - - if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0) goto fail1; diff --git a/sys/dev/sfxge/common/siena_nvram.c b/sys/dev/sfxge/common/siena_nvram.c index 5ad197d31de..cbfffbf3c12 100644 --- a/sys/dev/sfxge/common/siena_nvram.c +++ b/sys/dev/sfxge/common/siena_nvram.c @@ -245,6 +245,7 @@ siena_nvram_type_to_partn( efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); unsigned int i; + EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID); EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); EFSYS_ASSERT(partnp != NULL); -- 2.45.0