diff mbox

Warnings from drivers/clk/clk.c

Message ID CAOMZO5BfDRsO=gn_SjkDa_09KEf_EjZcfM5VQawaR1-dQE0o0g@mail.gmail.com (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Fabio Estevam Jan. 15, 2018, 4:48 p.m. UTC
Hi Stephen,

On Thu, Jan 11, 2018 at 7:19 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:

> We have two WARN_ON in this function. Do you know which one hit
> (makes me think we should put a printk in here now and also
> include the clk name).

Yes, having the clk name that causes the warning really helps debugging.

Do you mean like this?

the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Geert Uytterhoeven Jan. 16, 2018, 9:42 a.m. UTC | #1
Hi Fabio,

On Mon, Jan 15, 2018 at 5:48 PM, Fabio Estevam <festevam@gmail.com> wrote:
> On Thu, Jan 11, 2018 at 7:19 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> We have two WARN_ON in this function. Do you know which one hit
>> (makes me think we should put a printk in here now and also
>> include the clk name).
>
> Yes, having the clk name that causes the warning really helps debugging.
>
> Do you mean like this?
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 0f686a9..6fed292 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -681,8 +681,12 @@ static void clk_core_unprepare(struct clk_core *core)
>         if (!core)
>                 return;
>
> -       if (WARN_ON(core->prepare_count == 0))
> +       if (core->prepare_count == 0) {
> +               pr_err("%s: %s called with enable_count not zero\n",
> +                      __func__, core->name);
> +               WARN_ON(1);
>                 return;
> +       }

I believe you can just replace WARN_ON() by WARN(condition, format...)?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Fabio Estevam Jan. 16, 2018, 9:45 a.m. UTC | #2
Hi Geert,

On Tue, Jan 16, 2018 at 7:42 AM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:

> I believe you can just replace WARN_ON() by WARN(condition, format...)?

Yes, this looks nicer. Thanks for the hint!
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 0f686a9..6fed292 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -681,8 +681,12 @@  static void clk_core_unprepare(struct clk_core *core)
        if (!core)
                return;

-       if (WARN_ON(core->prepare_count == 0))
+       if (core->prepare_count == 0) {
+               pr_err("%s: %s called with enable_count not zero\n",
+                      __func__, core->name);
+               WARN_ON(1);
                return;
+       }

        if (WARN_ON(core->prepare_count == 1 && core->flags & CLK_IS_CRITICAL))
                return;
@@ -808,9 +812,14 @@  static void clk_core_disable(struct clk_core *core)
        if (!core)
                return;

-       if (WARN_ON(core->enable_count == 0))
+       if (core->enable_count == 0) {
+               pr_err("%s: %s called with enable_count not zero\n",
+                      __func__, core->name);
+               WARN_ON(1);
                return;

+       }
+
        if (WARN_ON(core->enable_count == 1 && core->flags & CLK_IS_CRITICAL))
                return;
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in