From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Anderson Date: Sun, 21 Mar 2021 00:37:43 -0400 Subject: [PATCH 4/6] clk: Return -ENOSYS when system call is not available In-Reply-To: <20210321031824.2170848-5-sjg@chromium.org> References: <20210321031824.2170848-1-sjg@chromium.org> <20210321031824.2170848-5-sjg@chromium.org> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 3/20/21 11:18 PM, Simon Glass wrote: > Update clk_composite_set_parent() to use -ENOSYS, which is the correct > error code for U-Boot. Also rearrange the code so that the error condition > is clearly indicated and the function runs to the end in the normal case, > since this is the common style in U-Boot. > > Signed-off-by: Simon Glass > --- > > drivers/clk/clk-composite.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c > index 7e99c5b910d..bb5351ebc0b 100644 > --- a/drivers/clk/clk-composite.c > +++ b/drivers/clk/clk-composite.c > @@ -37,10 +37,10 @@ static int clk_composite_set_parent(struct clk *clk, struct clk *parent) > const struct clk_ops *mux_ops = composite->mux_ops; > struct clk *mux = composite->mux; > > - if (mux && mux_ops) > - return mux_ops->set_parent(mux, parent); > - else > - return -ENOTSUPP; > + if (!mux || !mux_ops) > + return -ENOSYS; > + > + return mux_ops->set_parent(mux, parent); > } > > static unsigned long clk_composite_recalc_rate(struct clk *clk) > Reviewed-by: Sean Anderson Will this be applied to the whole clock subsystem? From what I can tell, the clock subsystem returns ENOSYS in these situations, and drivers return ENOTSUPP. It would be great if we could unified all these so callers could check for one return value. --Sean