On 20/06/2023 20:14, Bjorn Andersson wrote: > On Thu, Jun 15, 2023 at 11:26:13PM +0200, Krzysztof Kozlowski wrote: >> On 15/06/2023 23:12, Konrad Dybcio wrote: >>> As it turns out, not all regmap accesses succeed. Not knowing this is >>> particularly suboptimal when there's a breaking change to the regmap >>> APIs. Monitor the return values of regmap_ calls and propagate errors, >>> should any occur. >>> >>> To keep any level of readability in bwmon_enable(), add some comments >>> to separate the logical blocks. >>> >>> Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxx> >> >> Nice coincidence, I just had some talks with a friend about uselessness >> (IMHO) of regmap MMIO return status checks. >> >> Sorry, for me most of this makes the code difficult to read for no gain. >> Errors are not real. This is some artificial problem. Solving it makes >> code less maintainable. >> >> If we used here readl/writel, you would not add any checks, right? Then >> don't add for regmap mmio. >> > > I agree, the mmio regmap interface should only fail because of bugs or > things are misconfigured. Would be nice to capture that in a WARN_ON() > or something... > One choice could be to have for entire functions doing reads/writes: ret = 0; ret != regmap_write(); ret != regmap_write(); ret != regmap_write(); return ret; and handle this in the caller somehow. I don't think that aborting such chain early, just because regmap mmio failures, makes sense. Best regards, Krzysztof