Skip to content

Commit 2ba33a4

Browse files
westerirafaeljw
authored andcommitted
ACPI: watchdog: Fix gas->access_width usage
ACPI Generic Address Structure (GAS) access_width field is not in bytes as the driver seems to expect in few places so fix this by using the newly introduced macro ACPI_ACCESS_BYTE_WIDTH(). Fixes: b1abf6f ("ACPI / watchdog: Fix off-by-one error at resource assignment") Fixes: 058dfc7 ("ACPI / watchdog: Add support for WDAT hardware watchdog") Reported-by: Jean Delvare <[email protected]> Signed-off-by: Mika Westerberg <[email protected]> Reviewed-by: Jean Delvare <[email protected]> Cc: 4.16+ <[email protected]> # 4.16+ Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 1dade3a commit 2ba33a4

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

drivers/acpi/acpi_watchdog.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,11 @@ void __init acpi_watchdog_init(void)
136136
gas = &entries[i].register_region;
137137

138138
res.start = gas->address;
139+
res.end = res.start + ACPI_ACCESS_BYTE_WIDTH(gas->access_width) - 1;
139140
if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
140141
res.flags = IORESOURCE_MEM;
141-
res.end = res.start + ALIGN(gas->access_width, 4) - 1;
142142
} else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
143143
res.flags = IORESOURCE_IO;
144-
res.end = res.start + gas->access_width - 1;
145144
} else {
146145
pr_warn("Unsupported address space: %u\n",
147146
gas->space_id);

drivers/watchdog/wdat_wdt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ static int wdat_wdt_probe(struct platform_device *pdev)
389389

390390
memset(&r, 0, sizeof(r));
391391
r.start = gas->address;
392-
r.end = r.start + gas->access_width - 1;
392+
r.end = r.start + ACPI_ACCESS_BYTE_WIDTH(gas->access_width) - 1;
393393
if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
394394
r.flags = IORESOURCE_MEM;
395395
} else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {

0 commit comments

Comments
 (0)