public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail•com>
To: Thierry Reding <thierry.reding@gmail•com>
Cc: linux-tegra@vger•kernel.org,
	Nagarjuna Kristam <nkristam@nvidia•com>,
	linux-arm-kernel@lists•infradead.org,
	Jon Hunter <jonathanh@nvidia•com>
Subject: [PATCH 1/7] soc/tegra: fuse: Restore base on sysfs failure
Date: Fri, 30 Aug 2019 00:19:05 +0200	[thread overview]
Message-ID: <20190829221911.24876-2-thierry.reding@gmail.com> (raw)
In-Reply-To: <20190829221911.24876-1-thierry.reding@gmail.com>

From: Thierry Reding <treding@nvidia•com>

Make sure to also restore the register base address on sysfs
registration failure.

Signed-off-by: Thierry Reding <treding@nvidia•com>
---
 drivers/soc/tegra/fuse/fuse-tegra.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index 3eb44e65b326..6617a4bd11bb 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -146,20 +146,24 @@ static int tegra_fuse_probe(struct platform_device *pdev)
 
 	if (fuse->soc->probe) {
 		err = fuse->soc->probe(fuse);
-		if (err < 0) {
-			fuse->base = base;
-			return err;
-		}
+		if (err < 0)
+			goto restore;
 	}
 
 	if (tegra_fuse_create_sysfs(&pdev->dev, fuse->soc->info->size,
-				    fuse->soc->info))
-		return -ENODEV;
+				    fuse->soc->info)) {
+		err = -ENODEV;
+		goto restore;
+	}
 
 	/* release the early I/O memory mapping */
 	iounmap(base);
 
 	return 0;
+
+restore:
+	fuse->base = base;
+	return err;
 }
 
 static struct platform_driver tegra_fuse_driver = {
-- 
2.22.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-08-29 22:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-29 22:19 [PATCH 0/7] Replace Tegra FUSE API by nvmem API Thierry Reding
2019-08-29 22:19 ` Thierry Reding [this message]
2019-08-29 22:19 ` [PATCH 2/7] soc/tegra: fuse: Implement nvmem device Thierry Reding
2019-08-29 22:19 ` [PATCH 3/7] soc/tegra: fuse: Add cell information Thierry Reding
2019-08-29 22:19 ` [PATCH 4/7] soc/tegra: fuse: Register cell lookups for compatibility Thierry Reding
2019-08-29 22:19 ` [PATCH 5/7] drm/nouveau: tegra: Use nvmem API Thierry Reding
2019-08-29 22:19 ` [PATCH 6/7] phy: tegra: xusb: " Thierry Reding
2019-08-29 22:19 ` [PATCH 7/7] thermal: tegra: " Thierry Reding

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=20190829221911.24876-2-thierry.reding@gmail.com \
    --to=thierry.reding@gmail$(echo .)com \
    --cc=jonathanh@nvidia$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-tegra@vger$(echo .)kernel.org \
    --cc=nkristam@nvidia$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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