Skip to content

Commit f6f172d

Browse files
Wer-Wolfrafaeljw
authored andcommitted
ACPI: EC: Abort address space access upon error
When a multi-byte address space access is requested, acpi_ec_read()/ acpi_ec_write() is being called multiple times. Abort such operations if a single call to acpi_ec_read() / acpi_ec_write() fails, as the data read from / written to the EC might be incomplete. Signed-off-by: Armin Wolf <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 9b0abe7 commit f6f172d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/acpi/ec.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,10 +1333,13 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
13331333
if (ec->busy_polling || bits > 8)
13341334
acpi_ec_burst_enable(ec);
13351335

1336-
for (i = 0; i < bytes; ++i, ++address, ++value)
1336+
for (i = 0; i < bytes; ++i, ++address, ++value) {
13371337
result = (function == ACPI_READ) ?
13381338
acpi_ec_read(ec, address, value) :
13391339
acpi_ec_write(ec, address, *value);
1340+
if (result < 0)
1341+
break;
1342+
}
13401343

13411344
if (ec->busy_polling || bits > 8)
13421345
acpi_ec_burst_disable(ec);

0 commit comments

Comments
 (0)