Re: [PATCH 06/16] clk: tests: Add clk_parse_clkspec() Kunit testing

Miquel Raynal <[email protected]>
Newsgroups org.kernel.vger.linux-renesas-soc,org.kernel.vger.linux-clk,org.kernel.vger.linux-crypto,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
>> >> +	of_node_put(ctx->prov1_np);
>> >> +	of_node_put(ctx->prov2_np);
>> >
>> > Is there a double free of prov1_np and prov2_np? If this is dropped from
>> > the test exit, then they should't need to be in the ctx struct.
>> 
>> These two calls increment the refcount on the node:
>> - of_find_compatible_node()
>> - of_clk_add_hw_provider()
>> 
>> However this makes me realize maybe I should call of_clk_del_provider()
>> in the exit() function. In any case, I believe keeping a reference over
>> the nodes during the test is correct and if there is an of_node_put()
>> call to remove, it should be the on in the _init().
>
> Take a look at drivers/clk/clk_kunit_helpers.c.
> of_clk_add_hw_provider_kunit() will call of_clk_del_provider() for you
> via of_clk_del_provider_wrapper.

Nice, I didn't found that helper myself. Thanks for the pointers.

Thanks,
Miquèl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.