summaryrefslogtreecommitdiff
path: root/Platform/Marvell/Drivers/Spi/MvSpiDxe.c
diff options
context:
space:
mode:
Diffstat (limited to 'Platform/Marvell/Drivers/Spi/MvSpiDxe.c')
-rwxr-xr-xPlatform/Marvell/Drivers/Spi/MvSpiDxe.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/Platform/Marvell/Drivers/Spi/MvSpiDxe.c b/Platform/Marvell/Drivers/Spi/MvSpiDxe.c
index 3b491479ec..a7db5f2a2e 100755
--- a/Platform/Marvell/Drivers/Spi/MvSpiDxe.c
+++ b/Platform/Marvell/Drivers/Spi/MvSpiDxe.c
@@ -296,21 +296,22 @@ SPI_DEVICE *
EFIAPI
MvSpiSetupSlave (
IN MARVELL_SPI_MASTER_PROTOCOL *This,
+ IN SPI_DEVICE *Slave,
IN UINTN Cs,
IN SPI_MODE Mode
)
{
- SPI_DEVICE *Slave;
+ if (!Slave) {
+ Slave = AllocateZeroPool (sizeof(SPI_DEVICE));
+ if (Slave == NULL) {
+ DEBUG((DEBUG_ERROR, "Cannot allocate memory\n"));
+ return NULL;
+ }
- Slave = AllocateZeroPool (sizeof(SPI_DEVICE));
- if (Slave == NULL) {
- DEBUG((DEBUG_ERROR, "Cannot allocate memory\n"));
- return NULL;
+ Slave->Cs = Cs;
+ Slave->Mode = Mode;
}
- Slave->Cs = Cs;
- Slave->Mode = Mode;
-
SpiSetupTransfer (This, Slave);
return Slave;