Fix unharmful warning
Commit 54729fb458
removed some dead code spotted by Coverity
but it had as effect to trigger a gcc warning, which prefers to see all enum in a switch rather than dead code:
pn53x.c: In function 'pn53x_InJumpForDEP':
pn53x.c:2552:5: warning: enumeration value 'NBR_UNDEFINED' not handled in switch [-Wswitch]
pn53x.c:2552:5: warning: enumeration value 'NBR_847' not handled in switch [-Wswitch]
So both switches were merged, which slightly optimizes the code for speed.
This commit is contained in:
parent
7cb8fd3833
commit
4a91859150
1 changed files with 15 additions and 16 deletions
|
@ -2534,12 +2534,27 @@ pn53x_InJumpForDEP(struct nfc_device *pnd,
|
|||
switch (nbr) {
|
||||
case NBR_106:
|
||||
abtCmd[2] = 0x00; // baud rate is 106 kbps
|
||||
if (pbtPassiveInitiatorData && (ndm == NDM_PASSIVE)) { /* can't have passive initiator data when using active mode */
|
||||
abtCmd[3] |= 0x01;
|
||||
memcpy(abtCmd + offset, pbtPassiveInitiatorData, 4);
|
||||
offset += 4;
|
||||
}
|
||||
break;
|
||||
case NBR_212:
|
||||
abtCmd[2] = 0x01; // baud rate is 212 kbps
|
||||
if (pbtPassiveInitiatorData && (ndm == NDM_PASSIVE)) {
|
||||
abtCmd[3] |= 0x01;
|
||||
memcpy(abtCmd + offset, pbtPassiveInitiatorData, 5);
|
||||
offset += 5;
|
||||
}
|
||||
break;
|
||||
case NBR_424:
|
||||
abtCmd[2] = 0x02; // baud rate is 424 kbps
|
||||
if (pbtPassiveInitiatorData && (ndm == NDM_PASSIVE)) {
|
||||
abtCmd[3] |= 0x01;
|
||||
memcpy(abtCmd + offset, pbtPassiveInitiatorData, 5);
|
||||
offset += 5;
|
||||
}
|
||||
break;
|
||||
case NBR_847:
|
||||
case NBR_UNDEFINED:
|
||||
|
@ -2548,22 +2563,6 @@ pn53x_InJumpForDEP(struct nfc_device *pnd,
|
|||
break;
|
||||
}
|
||||
|
||||
if (pbtPassiveInitiatorData && (ndm == NDM_PASSIVE)) { /* can't have passive initiator data when using active mode */
|
||||
switch (nbr) {
|
||||
case NBR_106:
|
||||
abtCmd[3] |= 0x01;
|
||||
memcpy(abtCmd + offset, pbtPassiveInitiatorData, 4);
|
||||
offset += 4;
|
||||
break;
|
||||
case NBR_212:
|
||||
case NBR_424:
|
||||
abtCmd[3] |= 0x01;
|
||||
memcpy(abtCmd + offset, pbtPassiveInitiatorData, 5);
|
||||
offset += 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pbtNFCID3i) {
|
||||
abtCmd[3] |= 0x02;
|
||||
memcpy(abtCmd + offset, pbtNFCID3i, 10);
|
||||
|
|
Loading…
Reference in a new issue