Skip to content

Commit 956ef6c

Browse files
ardbiesheuvelmergify[bot]
authored andcommitted
ArmPkg/ArmScmiDxe: Use array indexing to access adjacent buffers
MessageParams1 and MessageParams2 always point to adjacent slots in the payload buffer, so no need to keep two separate pointers. Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent c6db764 commit 956ef6c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c

+4-7
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ ClockDescribeRates (
186186

187187
UINT32 PayloadLength;
188188
SCMI_COMMAND Cmd;
189-
UINT32 *MessageParams1;
190-
UINT32 *MessageParams2;
189+
UINT32 *MessageParams;
191190
CLOCK_DESCRIBE_RATES *DescribeRates;
192191
CLOCK_RATE_DWORD *Rate;
193192

@@ -200,19 +199,17 @@ ClockDescribeRates (
200199
RequiredArraySize = 0;
201200
RateIndex = 0;
202201

203-
Status = ScmiCommandGetPayload (&MessageParams1);
202+
Status = ScmiCommandGetPayload (&MessageParams);
204203
if (EFI_ERROR (Status)) {
205204
return Status;
206205
}
207206

208207
Cmd.ProtocolId = ScmiProtocolIdClock;
209208
Cmd.MessageId = ScmiMessageIdClockDescribeRates;
210209

211-
MessageParams2 = MessageParams1 + 1;
212-
213210
do {
214-
*MessageParams1 = ClockId;
215-
*MessageParams2 = RateIndex;
211+
MessageParams[0] = ClockId;
212+
MessageParams[1] = RateIndex;
216213

217214
// Set Payload length, note PayloadLength is a IN/OUT parameter.
218215
PayloadLength = sizeof (ClockId) + sizeof (RateIndex);

0 commit comments

Comments
 (0)