public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Heiner Kallweit <hkallweit1@gmail.com>,
	Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org
Subject: Re: [PATCH] clk: mux: let clk_mux_val_to_index return U8_MAX in the error case
Date: Thu, 13 Apr 2023 13:30:29 -0700	[thread overview]
Message-ID: <2203d5cc9350486e234198d8fff01641.sboyd@kernel.org> (raw)
In-Reply-To: <170e812b-01ad-2a5f-51fe-3d63f988ad68@gmail.com>

Quoting Heiner Kallweit (2023-04-13 12:27:27)
> On 13.04.2023 21:10, Stephen Boyd wrote:
> > Quoting Heiner Kallweit (2023-04-11 23:19:04)
> >> Currently this function may return a negative errno, but almost no
> >> user checks for the error case. Only imx_clk_gpr_mux_get_parent()
> >> does, but mentions in a comment that they'd prefer a dummy value.
> >> Other users cast the negative errno to u8 instead, what may result
> >> in unwanted results.
> >> Let's deal with this by returning u8 and U8_MAX in the error case.
> >> Then clk_core_get_parent_by_index() can detect that the index is
> >> out of range.
> > 
> > Is this causing problems for you?
> 
> I'm not directly impacted. I came across this when working on a driver
> with the following scenario:
> 
> I have a clock muxer where I want to exclude one of the mux parents
> by using clk_mux.table. If by chance the boot loader used this mux
> parent, then clk_mux_val_to_index() would return an errno.
> Also within clk core the return value isn't checked in
> clk_mux_get_parent().
> 

Ok. I'd rather go with a total rewrite of the get_parent clk_op[1] and fix
this at the same time.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/log/?h=clk-parent-rewrite

  reply	other threads:[~2023-04-13 20:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12  6:19 [PATCH] clk: mux: let clk_mux_val_to_index return U8_MAX in the error case Heiner Kallweit
2023-04-13 19:10 ` Stephen Boyd
2023-04-13 19:27   ` Heiner Kallweit
2023-04-13 20:30     ` Stephen Boyd [this message]
2023-04-13 20:47       ` Heiner Kallweit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2203d5cc9350486e234198d8fff01641.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox