[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAN4iqtS8GG4AMuAzi4jssqZBqyOUgwV21MP8FQeefGznhgcY9A@mail.gmail.com>
Date: Fri, 8 Nov 2024 14:39:47 -0500
From: Mingwei Zheng <zmw12306@...il.com>
To: Johannes Berg <johannes@...solutions.net>
Cc: linville@...driver.com, rklein@...dia.com, linux-wireless@...r.kernel.org,
linux-kernel@...r.kernel.org, Jiasheng Jiang <jiashengjiangcool@...il.com>
Subject: Re: [PATCH v2] net: rfkill: gpio: Add check for clk_enable()
On Fri, Nov 8, 2024 at 2:47 AM Johannes Berg <johannes@...solutions.net> wrote:
>
> 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
Thank you for your suggestion. I’ll make the corrections and send a v3 patch.
Best,
Mingwei
Powered by blists - more mailing lists