From: Johan Hovold <johan@kernel.org>
To: Lubomir Rintel <lkundrak@v3.sk>, Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <linux@armlinux.org.uk>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Johan Hovold <johan@kernel.org>,
stable@vger.kernel.org
Subject: [PATCH RESEND] ARM: mmp: fix platform-device leak on registration errors
Date: Mon, 20 Jun 2022 16:14:06 +0200 [thread overview]
Message-ID: <20220620141406.10122-1-johan@kernel.org> (raw)
Make sure to free the platform device also in the event that
registration fails.
Fixes: 49cbe78637eb ("[ARM] pxa: add base support for Marvell's PXA168 processor line")
Cc: stable@vger.kernel.org # 2.6.30
Signed-off-by: Johan Hovold <johan@kernel.org>
---
It's been almost four months so resending.
Arnd, can you pick this one up if Lubomir isn't around anymore?
Johan
arch/arm/mach-mmp/devices.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-mmp/devices.c b/arch/arm/mach-mmp/devices.c
index 79f4a2aa5475..dfb072d788ff 100644
--- a/arch/arm/mach-mmp/devices.c
+++ b/arch/arm/mach-mmp/devices.c
@@ -53,20 +53,25 @@ int __init mmp_register_device(struct mmp_device_desc *desc,
}
ret = platform_device_add_resources(pdev, res, nres);
- if (ret) {
- platform_device_put(pdev);
- return ret;
- }
+ if (ret)
+ goto err_put_device;
if (data && size) {
ret = platform_device_add_data(pdev, data, size);
- if (ret) {
- platform_device_put(pdev);
- return ret;
- }
+ if (ret)
+ goto err_put_device;
}
- return platform_device_add(pdev);
+ ret = platform_device_add(pdev);
+ if (ret)
+ goto err_put_device;
+
+ return 0;
+
+err_put_device:
+ platform_device_put(pdev);
+
+ return ret;
}
#if IS_ENABLED(CONFIG_USB) || IS_ENABLED(CONFIG_USB_GADGET)
--
2.35.1
WARNING: multiple messages have this Message-ID (diff)
From: Johan Hovold <johan@kernel.org>
To: Lubomir Rintel <lkundrak@v3.sk>, Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <linux@armlinux.org.uk>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Johan Hovold <johan@kernel.org>,
stable@vger.kernel.org
Subject: [PATCH RESEND] ARM: mmp: fix platform-device leak on registration errors
Date: Mon, 20 Jun 2022 16:14:06 +0200 [thread overview]
Message-ID: <20220620141406.10122-1-johan@kernel.org> (raw)
Make sure to free the platform device also in the event that
registration fails.
Fixes: 49cbe78637eb ("[ARM] pxa: add base support for Marvell's PXA168 processor line")
Cc: stable@vger.kernel.org # 2.6.30
Signed-off-by: Johan Hovold <johan@kernel.org>
---
It's been almost four months so resending.
Arnd, can you pick this one up if Lubomir isn't around anymore?
Johan
arch/arm/mach-mmp/devices.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-mmp/devices.c b/arch/arm/mach-mmp/devices.c
index 79f4a2aa5475..dfb072d788ff 100644
--- a/arch/arm/mach-mmp/devices.c
+++ b/arch/arm/mach-mmp/devices.c
@@ -53,20 +53,25 @@ int __init mmp_register_device(struct mmp_device_desc *desc,
}
ret = platform_device_add_resources(pdev, res, nres);
- if (ret) {
- platform_device_put(pdev);
- return ret;
- }
+ if (ret)
+ goto err_put_device;
if (data && size) {
ret = platform_device_add_data(pdev, data, size);
- if (ret) {
- platform_device_put(pdev);
- return ret;
- }
+ if (ret)
+ goto err_put_device;
}
- return platform_device_add(pdev);
+ ret = platform_device_add(pdev);
+ if (ret)
+ goto err_put_device;
+
+ return 0;
+
+err_put_device:
+ platform_device_put(pdev);
+
+ return ret;
}
#if IS_ENABLED(CONFIG_USB) || IS_ENABLED(CONFIG_USB_GADGET)
--
2.35.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2022-06-20 14:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 14:14 Johan Hovold [this message]
2022-06-20 14:14 ` [PATCH RESEND] ARM: mmp: fix platform-device leak on registration errors Johan Hovold
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=20220620141406.10122-1-johan@kernel.org \
--to=johan@kernel.org \
--cc=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lkundrak@v3.sk \
--cc=stable@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.