Re: [RFC PATCH v4 2/2] clk: Use devm_add in managed functions
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2020-03-02 10:14:44
Also in:
linux-clk, lkml
Hi Marc, On Mon, Mar 2, 2020 at 11:01 AM Marc Gonzalez [off-list ref] wrote:
On 27/02/2020 14:36, Geert Uytterhoeven wrote:quoted
On Wed, Feb 26, 2020 at 4:55 PM Marc Gonzalez [off-list ref] wrote:quoted
Using the helper produces simpler code, and smaller object size.
quoted
quoted
--- a/drivers/clk/clk-devres.c +++ b/drivers/clk/clk-devres.c
quoted
quoted
@@ -128,30 +109,22 @@ static int devm_clk_match(struct device *dev, void *res, void *data) void devm_clk_put(struct device *dev, struct clk *clk) { - int ret; - - ret = devres_release(dev, devm_clk_release, devm_clk_match, clk); - - WARN_ON(ret); + WARN_ON(devres_release(dev, my_clk_put, devm_clk_match, clk));Getting rid of "ret" is an unrelated change, which actually increases kernel size, as the WARN_ON() parameter is stringified for the warning message.Weird... Are you sure about that? I built the preprocessed file, and it didn't appear to be so. #ifndef WARN_ON #define WARN_ON(condition) ({ \ int __ret_warn_on = !!(condition); \ if (unlikely(__ret_warn_on)) \ __WARN(); \ unlikely(__ret_warn_on); \ }) #endif Maybe you were thinking of i915's WARN_ON? #define WARN_ON(x) WARN((x), "%s", "WARN_ON(" __stringify(x) ")")
Oops, you're right. I got trapped again by an override of a standard macro
(IMHO this should be removed).
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel