EmbeddedPkg/Lan9118Dxe: Fixed dereferencing optional NULL pointer

TxBuff argument is optional in SNP.GetStatus(). This argument can be NULL.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16236 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Olivier Martin 2014-10-27 10:35:57 +00:00 committed by oliviermartin
parent c9263c7dd2
commit a537c71726
1 changed files with 2 additions and 2 deletions

View File

@ -918,7 +918,7 @@ SnpGetStatus (
TxStatus = MmioRead32 (LAN9118_TX_STATUS);
PacketTag = TxStatus >> 16;
TxStatus = TxStatus & 0xFFFF;
if ((TxStatus & TXSTATUS_ES) && TxStatus != (TXSTATUS_ES | TXSTATUS_NO_CA)) {
if ((TxStatus & TXSTATUS_ES) && (TxStatus != (TXSTATUS_ES | TXSTATUS_NO_CA))) {
DEBUG ((EFI_D_ERROR, "LAN9118: There was an error transmitting. TxStatus=0x%08x:", TxStatus));
if (TxStatus & TXSTATUS_NO_CA) {
DEBUG ((EFI_D_ERROR, "- No carrier\n"));
@ -939,7 +939,7 @@ SnpGetStatus (
DEBUG ((EFI_D_ERROR, "- Lost carrier during Tx\n"));
}
return EFI_DEVICE_ERROR;
} else {
} else if (TxBuff != NULL) {
LanDriver->Stats.TxTotalFrames += 1;
*TxBuff = LanDriver->TxRing[PacketTag % LAN9118_TX_RING_NUM_ENTRIES];
}