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:
Philippe Teuwen 2013-09-22 12:02:31 +02:00
parent 7cb8fd3833
commit 4a91859150

View file

@ -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);