mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Mingwei Zheng <zmw12306@gmail.com>
Cc: linville@tuxdriver.com, rklein@nvidia.com,
	linux-wireless@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Jiasheng Jiang <jiashengjiangcool@gmail.com>
Subject: Re: [PATCH v2] net: rfkill: gpio: Add check for clk_enable()
Date: Fri, 08 Nov 2024 08:47:28 +0100	[thread overview]
Message-ID: <f1a0801e4ce55cdccfa809a6e49d839aabf1a0ae.camel@sipsolutions.net> (raw)
In-Reply-To: <20241107222043.1414437-1-zmw12306@gmail.com>

On Thu, 2024-11-07 at 17:20 -0500, Mingwei Zheng wrote:
> Add check for the return value of clk_enable() to catch the potential
> error.

Wait ... is someone running an experiment again? ;-)
> 
> diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
> index c268c2b011f4..a87bb99231a6 100644
> --- a/net/rfkill/rfkill-gpio.c
> +++ b/net/rfkill/rfkill-gpio.c
> @@ -31,9 +31,13 @@ struct rfkill_gpio_data {
>  static int rfkill_gpio_set_power(void *data, bool blocked)
>  {
>  	struct rfkill_gpio_data *rfkill = data;
> +	int ret;

You could move that into the if.

> -	if (!blocked && !IS_ERR(rfkill->clk) && !rfkill->clk_enabled)
> -		clk_enable(rfkill->clk);
> +	if (!blocked && !IS_ERR(rfkill->clk) && !rfkill->clk_enabled) {
> +		ret = clk_enable(rfkill->clk);
> +		if (!ret)
> +			return ret;
> +	}
> 

but this is obviously wrong anyway.

johannes

  reply	other threads:[~2024-11-08  7:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-07 22:20 Mingwei Zheng
2024-11-08  7:47 ` Johannes Berg [this message]
2024-11-08 19:39   ` Mingwei Zheng

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=f1a0801e4ce55cdccfa809a6e49d839aabf1a0ae.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=jiashengjiangcool@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=rklein@nvidia.com \
    --cc=zmw12306@gmail.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®