File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
MdeModulePkg/Bus/Spi/SpiBus Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -329,8 +329,17 @@ Transaction (
329329 ((SpiChip -> SpiHc -> Attributes & HC_SUPPORTS_WRITE_THEN_READ_OPERATIONS ) != HC_SUPPORTS_WRITE_THEN_READ_OPERATIONS ))
330330 {
331331 // Convert to full duplex transaction
332- DummyReadBuffer = AllocateZeroPool (WriteBytes );
333- DummyWriteBuffer = AllocateZeroPool (ReadBytes );
332+ DummyReadBuffer = AllocateZeroPool (WriteBytes );
333+ if (DummyReadBuffer == NULL ) {
334+ return EFI_OUT_OF_RESOURCES ;
335+ }
336+
337+ DummyWriteBuffer = AllocateZeroPool (ReadBytes );
338+ if (DummyWriteBuffer == NULL ) {
339+ FreePool (DummyReadBuffer );
340+ return EFI_OUT_OF_RESOURCES ;
341+ }
342+
334343 SpiChip -> BusTransaction .ReadBuffer = DummyReadBuffer ;
335344 SpiChip -> BusTransaction .ReadBytes = WriteBytes ;
336345
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ SpiBusEntry (
108108 // Get SpiHc from the SpiHcHandles
109109 Status = gBS -> HandleProtocol (
110110 SpiHcHandles [HcIndex ],
111- & gEfiDevicePathProtocolGuid ,
111+ & gEfiSpiHcProtocolGuid ,
112112 (VOID * * )& SpiHc
113113 );
114114
You can’t perform that action at this time.
0 commit comments