From: Lin Yujun <linyujun809@huawei.com>
To: <a.zummo@towertech.it>, <alexandre.belloni@bootlin.com>,
<mcoquelin.stm32@gmail.com>, <alexandre.torgue@foss.st.com>,
<akpm@linux-foundation.org>, <wsa@kernel.org>, <wim@iguana.be>
Cc: <linux-rtc@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH -next v2] rtc: stmp3xxx: Add failure handling for stmp3xxx_wdt_register()
Date: Thu, 15 Sep 2022 09:33:04 +0800 [thread overview]
Message-ID: <20220915013304.213917-1-linyujun809@huawei.com> (raw)
Use platform_device_put() to free platform device before print
error message when platform_device_add() fails to run. Add dev_err()
to report error in case of alloc memory to wdt_pdev fail.
Fixes: 1a71fb84fda6 ("rtc: stmp3xxx: add wdt-accessor function")
Signed-off-by: Lin Yujun <linyujun809@huawei.com>
---
drivers/rtc/rtc-stmp3xxx.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c
index 40c0f7ed36e0..aae40d20d086 100644
--- a/drivers/rtc/rtc-stmp3xxx.c
+++ b/drivers/rtc/rtc-stmp3xxx.c
@@ -107,6 +107,8 @@ static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev)
wdt_pdev->dev.parent = &rtc_pdev->dev;
wdt_pdev->dev.platform_data = &wdt_pdata;
rc = platform_device_add(wdt_pdev);
+ if (rc)
+ platform_device_put(wdt_pdev);
}
if (rc)
--
2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Lin Yujun <linyujun809@huawei.com>
To: <a.zummo@towertech.it>, <alexandre.belloni@bootlin.com>,
<mcoquelin.stm32@gmail.com>, <alexandre.torgue@foss.st.com>,
<akpm@linux-foundation.org>, <wsa@kernel.org>, <wim@iguana.be>
Cc: <linux-rtc@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH -next v2] rtc: stmp3xxx: Add failure handling for stmp3xxx_wdt_register()
Date: Thu, 15 Sep 2022 09:33:04 +0800 [thread overview]
Message-ID: <20220915013304.213917-1-linyujun809@huawei.com> (raw)
Use platform_device_put() to free platform device before print
error message when platform_device_add() fails to run. Add dev_err()
to report error in case of alloc memory to wdt_pdev fail.
Fixes: 1a71fb84fda6 ("rtc: stmp3xxx: add wdt-accessor function")
Signed-off-by: Lin Yujun <linyujun809@huawei.com>
---
drivers/rtc/rtc-stmp3xxx.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c
index 40c0f7ed36e0..aae40d20d086 100644
--- a/drivers/rtc/rtc-stmp3xxx.c
+++ b/drivers/rtc/rtc-stmp3xxx.c
@@ -107,6 +107,8 @@ static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev)
wdt_pdev->dev.parent = &rtc_pdev->dev;
wdt_pdev->dev.platform_data = &wdt_pdata;
rc = platform_device_add(wdt_pdev);
+ if (rc)
+ platform_device_put(wdt_pdev);
}
if (rc)
--
2.17.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-09-15 1:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-15 1:33 Lin Yujun [this message]
2022-09-15 1:33 ` [PATCH -next v2] rtc: stmp3xxx: Add failure handling for stmp3xxx_wdt_register() Lin Yujun
2022-09-15 6:31 ` Wolfram Sang
2022-09-15 6:31 ` Wolfram Sang
2022-09-15 6:54 ` linyujun (C)
2022-09-15 6:54 ` linyujun (C)
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=20220915013304.213917-1-linyujun809@huawei.com \
--to=linyujun809@huawei.com \
--cc=a.zummo@towertech.it \
--cc=akpm@linux-foundation.org \
--cc=alexandre.belloni@bootlin.com \
--cc=alexandre.torgue@foss.st.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=wim@iguana.be \
--cc=wsa@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.