diff mbox series

[v2] soundwire: amd: Fix a check for errors in probe()

Message ID 9863b2bf-0de2-4bf8-8f09-fe24dc5c63ff@moroto.mountain (mailing list archive)
State New, archived
Headers show
Series [v2] soundwire: amd: Fix a check for errors in probe() | expand

Commit Message

Dan Carpenter June 27, 2023, 5:42 a.m. UTC
This code has two problems:
1) The devm_ioremap() function returns NULL, not error pointers.
2) It's checking the wrong variable.  ->mmio instead of ->acp_mmio.

Fixes: a673a8dfc214 ("soundwire: amd: Add support for AMD Manager driver")
Suggested-by: "Mukunda,Vijendar" <vijendar.mukunda@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
v2: Change the variable.  My original fix would have prevented the
driver from loading so many thanks to Vijendar for pointing that out.

 drivers/soundwire/amd_manager.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Vinod Koul July 10, 2023, 10:25 a.m. UTC | #1
On Tue, 27 Jun 2023 08:42:10 +0300, Dan Carpenter wrote:
> This code has two problems:
> 1) The devm_ioremap() function returns NULL, not error pointers.
> 2) It's checking the wrong variable.  ->mmio instead of ->acp_mmio.
> 
> 

Applied, thanks!

[1/1] soundwire: amd: Fix a check for errors in probe()
      commit: a06d6088cfd49b63a2759910f2328ba28d6a342d

Best regards,
diff mbox series

Patch

diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c
index 08aeb7ed00e1..3a99f6dcdfaf 100644
--- a/drivers/soundwire/amd_manager.c
+++ b/drivers/soundwire/amd_manager.c
@@ -910,9 +910,9 @@  static int amd_sdw_manager_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	amd_manager->acp_mmio = devm_ioremap(dev, res->start, resource_size(res));
-	if (IS_ERR(amd_manager->mmio)) {
+	if (!amd_manager->acp_mmio) {
 		dev_err(dev, "mmio not found\n");
-		return PTR_ERR(amd_manager->mmio);
+		return -ENOMEM;
 	}
 	amd_manager->instance = pdata->instance;
 	amd_manager->mmio = amd_manager->acp_mmio +