devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Conor Dooley <Conor.Dooley@microchip.com>
Cc: Daire.McNamara@microchip.com,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
	david.abdurachmanov@gmail.com,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Cyril.Jean@microchip.com
Subject: Re: [PATCH v6 2/2] clk: microchip: Add driver for Microchip PolarFire SoC
Date: Wed, 8 Dec 2021 19:28:29 +0100	[thread overview]
Message-ID: <CAMuHMdW15iBaPqgAjq2tpXHwKtL0yPv4RuXtuqmbExgRP8BVGQ@mail.gmail.com> (raw)
In-Reply-To: <3e2a08f5-d1b0-e2d3-c418-4b5b352f0800@microchip.com>

Hi Conor,

On Wed, Dec 8, 2021 at 4:30 PM <Conor.Dooley@microchip.com> wrote:
> Just going to ack the other items you raised for now, but curious about
> this one:
> On 06/12/2021 15:53, Geert Uytterhoeven wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >> +static void mpfs_clk_unregister_cfg(struct device *dev, struct clk_hw *hw)
> >> +{
> >> +       struct mpfs_cfg_hw_clock *cfg_hw = to_mpfs_cfg_clk(hw);
> >> +
> >> +       devm_clk_hw_unregister(dev, hw);
> >> +       kfree(cfg_hw);
> >
> > This is freeing a part of the big array allocated with devm_kzalloc()?
> I took a look at this, and I don't think it is freeing the devm
> allocated array.
>
> To me, what is actually being freed is an element in the array of
> structs passed to mpfs_clk_register_cfgs in the probe function.
> However, this struct is statically defined - so its elements shouldn't
> be freed at all?

You're right, it's part of the static array.  I was misled by the
back-and-forth conversions between the different types.
Regardless, the kfree() calls should be removed.

> drivers/clk/clk-bm1880.c has the same behaviour in the unregister
> function, where it calls kfree on the elements of a static array of clk
> structs. So if my understanding is correct it would need fixing there too.

If that is true (didn't check), it needs to be fixed, too.

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

      reply	other threads:[~2021-12-08 18:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 14:07 [PATCH v6 0/2] CLK: microchip: Add clkcfg driver for Microchip PolarFire SoC conor.dooley
2021-11-30 14:07 ` [PATCH v6 1/2] dt-bindings: clk: microchip: Add Microchip PolarFire host binding conor.dooley
2021-12-06 15:12   ` Geert Uytterhoeven
2021-11-30 14:07 ` [PATCH v6 2/2] clk: microchip: Add driver for Microchip PolarFire SoC conor.dooley
2021-12-06 15:53   ` Geert Uytterhoeven
2021-12-08 15:29     ` Conor.Dooley
2021-12-08 18:28       ` Geert Uytterhoeven [this message]

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=CAMuHMdW15iBaPqgAjq2tpXHwKtL0yPv4RuXtuqmbExgRP8BVGQ@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=Conor.Dooley@microchip.com \
    --cc=Cyril.Jean@microchip.com \
    --cc=Daire.McNamara@microchip.com \
    --cc=david.abdurachmanov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=palmer@dabbelt.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).