From: Mingwei Zheng <zmw12306@gmail.com>
To: johannes@sipsolutions.net
Cc: linville@tuxdriver.com, rklein@nvidia.com,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
Mingwei Zheng <zmw12306@gmail.com>,
Jiasheng Jiang <jiashengjiangcool@gmail.com>
Subject: [PATCH] net: rfkill: gpio: Add check for clk_enable()
Date: Fri, 8 Nov 2024 13:55:59 -0500 [thread overview]
Message-ID: <20241108185559.1832652-1-zmw12306@gmail.com> (raw)
Add check for the return value of clk_enable() to catch the potential
error.
Fixes: 7176ba23f8b5 ("net: rfkill: add generic gpio rfkill driver")
Signed-off-by: Mingwei Zheng <zmw12306@gmail.com>
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
---
Changelog:
v2 -> v3
1. Move int ret declaration into if.
2. Replace if (!ret) with if (ret).
---
Changelog:
v1 -> v2
1. Replace expection with error in commit msg.
---
net/rfkill/rfkill-gpio.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index c268c2b011f4..a8e21060112f 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -32,8 +32,12 @@ static int rfkill_gpio_set_power(void *data, bool blocked)
{
struct rfkill_gpio_data *rfkill = data;
- if (!blocked && !IS_ERR(rfkill->clk) && !rfkill->clk_enabled)
- clk_enable(rfkill->clk);
+ if (!blocked && !IS_ERR(rfkill->clk) && !rfkill->clk_enabled) {
+ int ret = clk_enable(rfkill->clk);
+
+ if (ret)
+ return ret;
+ }
gpiod_set_value_cansleep(rfkill->shutdown_gpio, !blocked);
gpiod_set_value_cansleep(rfkill->reset_gpio, !blocked);
--
2.34.1
next reply other threads:[~2024-11-08 18:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-08 18:55 Mingwei Zheng [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-11-07 21:01 Mingwei Zheng
2024-11-07 21:13 ` Johannes Berg
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=20241108185559.1832652-1-zmw12306@gmail.com \
--to=zmw12306@gmail.com \
--cc=jiashengjiangcool@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=rklein@nvidia.com \
/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®