summaryrefslogtreecommitdiffstats
path: root/sys/dev/pccard
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2005-02-17 21:05:04 +0000
committerimp <imp@FreeBSD.org>2005-02-17 21:05:04 +0000
commite5407e02ccbe293aab2f0a0d68909e90857f71a6 (patch)
treeea61f3944f6e1b1c03e94d082d316c08d3f8cef7 /sys/dev/pccard
parentfcb0c9784b57f325a17b1870efc2148a646c3d2a (diff)
downloadFreeBSD-src-e5407e02ccbe293aab2f0a0d68909e90857f71a6.zip
FreeBSD-src-e5407e02ccbe293aab2f0a0d68909e90857f71a6.tar.gz
memspace is set to some value by masking off bits. When these bits
are equal to PCCARD_TPCE_FS_MEMSPACE_NONE, memspace will be zero, so testing for this case inside of the if statement results in dead code. We'd fail to set a value to zero that's already zero (since it is initialized to 0 indirectly) with this code being there. Well, except in the very rare case that we have a card that has a defualt entry that includes a memory space followed by one that has no memory space (these are extremely rare, I don't recall ever having seen one :-). Fix this by setting num_memspace to 0 in a more appropriate place. Submitted by: Coverity Prevent analysis tool
Diffstat (limited to 'sys/dev/pccard')
-rw-r--r--sys/dev/pccard/pccard_cis.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/dev/pccard/pccard_cis.c b/sys/dev/pccard/pccard_cis.c
index 4286208..fce85e7 100644
--- a/sys/dev/pccard/pccard_cis.c
+++ b/sys/dev/pccard/pccard_cis.c
@@ -1142,9 +1142,7 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
goto abort_cfe;
}
- if (memspace == PCCARD_TPCE_FS_MEMSPACE_NONE) {
- cfe->num_memspace = 0;
- } else if (memspace == PCCARD_TPCE_FS_MEMSPACE_LENGTH) {
+ if (memspace == PCCARD_TPCE_FS_MEMSPACE_LENGTH) {
cfe->num_memspace = 1;
cfe->memspace[0].length = 256 *
pccard_tuple_read_2(tuple, idx);
@@ -1227,7 +1225,8 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
}
}
}
- }
+ } else
+ cfe->num_memspace = 0;
if (misc) {
if (tuple->length <= idx) {
DPRINTF(("ran out of space before TCPE_MI\n"));
OpenPOWER on IntegriCloud