mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Evgeny Bachinin <EABachinin@salutedevices.com>
To: Neil Armstrong <neil.armstrong@linaro.org>,
	Kevin Hilman <khilman@baylibre.com>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Evgeny Bachinin <EABachinin@salutedevices.com>,
	Dmitry Rokosov <ddrokosov@sberdevices.ru>,
	Miles Chen <miles.chen@mediatek.com>,
	Alexey Romanov <avromanov@salutedevices.com>
Cc: <kernel@sberdevices.ru>, <evgen89bachinin@gmail.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-amlogic@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH v1 2/2] firmware: meson-sm: unmap out_base shmem in error path
Date: Wed, 8 Nov 2023 15:56:04 +0300	[thread overview]
Message-ID: <20231108125604.162383-3-EABachinin@salutedevices.com> (raw)
In-Reply-To: <20231108125604.162383-1-EABachinin@salutedevices.com>

When SM driver was introduced in [1], the code flow did not require
to unmap out_base shmem in case of errors inside probe().
During [2], the additional error path appeared, which requires unmap.

Patch adds iounmap() missed.

Links:
[1] https://lore.kernel.org/linux-amlogic/1466339944-602-2-git-send-email-carlo@caione.org/
[2] https://lore.kernel.org/linux-amlogic/1532613556-5398-1-git-send-email-narmstrong@baylibre.com/

Fixes: 0789724f86a5 ("firmware: meson_sm: Add serial number sysfs entry")
Signed-off-by: Evgeny Bachinin <EABachinin@salutedevices.com>
---
 drivers/firmware/meson/meson_sm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
index 73878ff9833c..ca5f3534eddd 100644
--- a/drivers/firmware/meson/meson_sm.c
+++ b/drivers/firmware/meson/meson_sm.c
@@ -307,7 +307,7 @@ static int __init meson_sm_probe(struct platform_device *pdev)
 		fw->sm_shmem_out_base = meson_sm_map_shmem(chip->cmd_shmem_out_base,
 							   chip->shmem_size);
 		if (WARN_ON(!fw->sm_shmem_out_base))
-			goto out_in_base;
+			goto unmap_in_base;
 	}
 
 	fw->chip = chip;
@@ -315,13 +315,15 @@ static int __init meson_sm_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, fw);
 
 	if (devm_of_platform_populate(dev))
-		goto out_in_base;
+		goto unmap_out_base;
 
 	pr_info("secure-monitor enabled\n");
 
 	return 0;
 
-out_in_base:
+unmap_out_base:
+	iounmap(fw->sm_shmem_out_base);
+unmap_in_base:
 	iounmap(fw->sm_shmem_in_base);
 out:
 	return -EINVAL;
-- 
2.34.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  parent reply	other threads:[~2023-11-08 12:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-08 12:56 [PATCH v1 0/2] firmware: meson_sm: cleanup error paths inside probe() Evgeny Bachinin
2023-11-08 12:56 ` [PATCH v1 1/2] firmware: meson_sm: refactor serial sysfs entry via dev_groups attrs Evgeny Bachinin
2023-11-08 12:56 ` Evgeny Bachinin [this message]
2023-11-27  8:02 ` [PATCH v1 0/2] firmware: meson_sm: cleanup error paths inside probe() Neil Armstrong
2023-11-27  8:18 ` Neil Armstrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231108125604.162383-3-EABachinin@salutedevices.com \
    --to=eabachinin@salutedevices.com \
    --cc=avromanov@salutedevices.com \
    --cc=ddrokosov@sberdevices.ru \
    --cc=evgen89bachinin@gmail.com \
    --cc=jbrunet@baylibre.com \
    --cc=kernel@sberdevices.ru \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=miles.chen@mediatek.com \
    --cc=neil.armstrong@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®