Re: [PATCH v6 1/6] clk: Add of_clk_get_by_name_optional() function

From: Uwe Kleine-König
Date: Fri Nov 16 2018 - 11:11:33 EST


On Fri, Nov 16, 2018 at 05:01:28PM +0100, Uwe Kleine-König wrote:
> Other than that I think the patch is fine

Thinking again, I wonder why not just do:

static inline struct clk *clk_get_optional(struct device *dev, const char *id)
{
struct clk *c = clk_get(dev, id);

if (c == ERR_PTR(-ENOENT))
return NULL;
else
return c;
}

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |