| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2014 Linaro Ltd. |
|---|
| 3 | 4 | * Author: Ashwin Chaugule <ashwin.chaugule@linaro.org> |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 7 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 8 | | - * (at your option) any later version. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | 5 | * |
|---|
| 15 | 6 | * PCC (Platform Communication Channel) is defined in the ACPI 5.0+ |
|---|
| 16 | 7 | * specification. It is a mailbox like mechanism to allow clients |
|---|
| .. | .. |
|---|
| 382 | 373 | * |
|---|
| 383 | 374 | * This gets called for each entry in the PCC table. |
|---|
| 384 | 375 | */ |
|---|
| 385 | | -static int parse_pcc_subspace(struct acpi_subtable_header *header, |
|---|
| 376 | +static int parse_pcc_subspace(union acpi_subtable_headers *header, |
|---|
| 386 | 377 | const unsigned long end) |
|---|
| 387 | 378 | { |
|---|
| 388 | 379 | struct acpi_pcct_subspace *ss = (struct acpi_pcct_subspace *) header; |
|---|
| .. | .. |
|---|
| 466 | 457 | pr_warn("Error parsing PCC subspaces from PCCT\n"); |
|---|
| 467 | 458 | else |
|---|
| 468 | 459 | pr_warn("Invalid PCCT: %d PCC subspaces\n", count); |
|---|
| 469 | | - return -EINVAL; |
|---|
| 460 | + |
|---|
| 461 | + rc = -EINVAL; |
|---|
| 462 | + goto err_put_pcct; |
|---|
| 470 | 463 | } |
|---|
| 471 | 464 | |
|---|
| 472 | 465 | pcc_mbox_channels = kcalloc(count, sizeof(struct mbox_chan), |
|---|
| 473 | 466 | GFP_KERNEL); |
|---|
| 474 | 467 | if (!pcc_mbox_channels) { |
|---|
| 475 | 468 | pr_err("Could not allocate space for PCC mbox channels\n"); |
|---|
| 476 | | - return -ENOMEM; |
|---|
| 469 | + rc = -ENOMEM; |
|---|
| 470 | + goto err_put_pcct; |
|---|
| 477 | 471 | } |
|---|
| 478 | 472 | |
|---|
| 479 | 473 | pcc_doorbell_vaddr = kcalloc(count, sizeof(void *), GFP_KERNEL); |
|---|
| .. | .. |
|---|
| 544 | 538 | kfree(pcc_doorbell_vaddr); |
|---|
| 545 | 539 | err_free_mbox: |
|---|
| 546 | 540 | kfree(pcc_mbox_channels); |
|---|
| 541 | +err_put_pcct: |
|---|
| 542 | + acpi_put_table(pcct_tbl); |
|---|
| 547 | 543 | return rc; |
|---|
| 548 | 544 | } |
|---|
| 549 | 545 | |
|---|
| .. | .. |
|---|
| 577 | 573 | return ret; |
|---|
| 578 | 574 | } |
|---|
| 579 | 575 | |
|---|
| 580 | | -struct platform_driver pcc_mbox_driver = { |
|---|
| 576 | +static struct platform_driver pcc_mbox_driver = { |
|---|
| 581 | 577 | .probe = pcc_mbox_probe, |
|---|
| 582 | 578 | .driver = { |
|---|
| 583 | 579 | .name = "PCCT", |
|---|