[PATCH v2 01/11] pwm: Make .get_state() callback return an error code

Andre Przywara andre.przywara at arm.com
Thu Dec 1 06:17:07 PST 2022


On Thu, 1 Dec 2022 14:16:04 +0100
Uwe Kleine-König <u.kleine-koenig at pengutronix.de> wrote:

Hi Uwe,

> Hello Andre,
> 
> On Thu, Dec 01, 2022 at 10:22:52AM +0000, Andre Przywara wrote:
> > Just one comment: I don't see a sunxi specific patch later in the series,
> > though it seems we have at least one error error exit (see prescaler == 0
> > above). Plus potentially another exit if clk_get_rate() (at the very
> > beginning) fails.
> > Shall I send a patch for that?  
> 
> That would we very welcome. I mentioned that shortly in the cover
> letter, I wasn't entirely sure how to handle that prescaler = 0 case.

Ah right, sorry, I missed that.
So the Allwinner manual somehow marks those prescaler encodings as reserved
or invalid (it's just a "/" in there), and we never set those values in the
driver (there is an explicit check). So it could only be a leftover from
firmware/bootloader, or someone poking at this register behind our back.
I am tempted to just return some -EINVAL. As the current code stands, we
don't manipulate any state flags before that check, so it doesn't
really matter, but would be best practise, at least.

Cheers,
Andre



More information about the linux-riscv mailing list