lkml.org 
[lkml]   [2018]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] clk: Add (devm_)clk_get_optional() functions
On Tue, Nov 20, 2018 at 01:56:52PM +0100, Uwe Kleine-König wrote:
> On Tue, Nov 20, 2018 at 12:38:33PM +0200, Andy Shevchenko wrote:
> > On Mon, Nov 19, 2018 at 02:12:59PM +0000, Phil Edworthy wrote:
> > > + if (clk == ERR_PTR(-ENOENT))
> > > + return NULL;
> > > + else
> > > + return clk;
> >
> > return clk == ERR_PTR(-ENOENT) ? NULL : clk;
> >
> > ?
>
> Not sure this adds to the readability of the expression. Personally I
> prefer the explicit if. Maybe even:
>
> clk = clk_get(...);
>
> if (clk == ERR_PTR(-ENOENT))
> clk = NULL;
>
> return clk;

So, it almost repeats the initial variant.
I'm fine with no 'else' in initial code, like

if (...)
return NULL;

return clk;


--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2018-11-20 14:26    [W:0.060 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site