linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] mailbox: pcc: Put the PCCT table for error path
@ 2020-07-23  5:33 Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2020-07-23  5:33 UTC (permalink / raw)
  To: Hanjun Guo, Jassi Brar; +Cc: linux-kernel, kernel-janitors

…
> In acpi_pcc_probe(), the PCCT table entries will be used as private
> data for communication chan at runtime, but the table should be put
> for error path.

* An imperative wording can be preferred for the change description,
  can't it?

* Will the tag “Fixes” become helpful for the commit message?

Regards,
Markus

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] mailbox: pcc: Put the PCCT table for error path
@ 2020-07-22  9:40 Hanjun Guo
  0 siblings, 0 replies; 2+ messages in thread
From: Hanjun Guo @ 2020-07-22  9:40 UTC (permalink / raw)
  To: Jassi Brar; +Cc: linux-kernel, Hanjun Guo

The acpi_get_table() should be coupled with acpi_put_table() if
the mapped table is not used at runtime to release the table
mapping.

In acpi_pcc_probe(), the PCCT table entries will be used as private
data for communication chan at runtime, but the table should be put
for error path.

Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
---
 drivers/mailbox/pcc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
index 8c7fac3..ef9ecd1 100644
--- a/drivers/mailbox/pcc.c
+++ b/drivers/mailbox/pcc.c
@@ -457,14 +457,17 @@ static int __init acpi_pcc_probe(void)
 			pr_warn("Error parsing PCC subspaces from PCCT\n");
 		else
 			pr_warn("Invalid PCCT: %d PCC subspaces\n", count);
-		return -EINVAL;
+
+		rc = -EINVAL;
+		goto err_put_pcct;
 	}
 
 	pcc_mbox_channels = kcalloc(count, sizeof(struct mbox_chan),
 				    GFP_KERNEL);
 	if (!pcc_mbox_channels) {
 		pr_err("Could not allocate space for PCC mbox channels\n");
-		return -ENOMEM;
+		rc = -ENOMEM;
+		goto err_put_pcct;
 	}
 
 	pcc_doorbell_vaddr = kcalloc(count, sizeof(void *), GFP_KERNEL);
@@ -535,6 +538,8 @@ static int __init acpi_pcc_probe(void)
 	kfree(pcc_doorbell_vaddr);
 err_free_mbox:
 	kfree(pcc_mbox_channels);
+err_put_pcct:
+	acpi_put_table(pcct_tbl);
 	return rc;
 }
 
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-23  5:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-23  5:33 [PATCH] mailbox: pcc: Put the PCCT table for error path Markus Elfring
  -- strict thread matches above, loose matches on Subject: below --
2020-07-22  9:40 Hanjun Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).