FreeBSD/src bfeb2bd (r332843)sys/dev/extres/regulator regulator.c

regulator: Check status before disabling

When disabling regulator when they are unused, check before is they are
enabled.
While here don't check the enable_cnt on the regulator entry as it is
checked by regnode_stop.
This solve the panic on any board using a fixed regulator that is driven
by a gpio when the regulator is unused.

Tested On: OrangePi One
Pointy Hat to:      myself
Reported by:    kevans, Milan Obuch (freebsd-arm at dino.sk)
DeltaFile
+5-3sys/dev/extres/regulator/regulator.c
+5-31 files

UnifiedSplitRaw

FreeBSD/src 3328431 (r250409)sys/kern uipc_syscalls.c

Item 1 in r248830 causes earlier exits from the sendfile(2), before
all requested data was sent.  The reason is that xfsize <= 0 condition
must not be tested at all if space == loopbytes.  Otherwise, the done
is set to 1, and sendfile(2) is aborted too early.

Instead of moving the condition to exiting the inner loop after the
xfersize check, directly check for the completed transfer before the
testing of the available space in the socket buffer, and revert item 1
of r248830.  It is arguably another bug to sleep waiting for socket
buffer space (or return EAGAIN for non-blocking socket) if all bytes
are already transferred.

Reported by:    pho
Discussed with: scottl, gibbs
Tested by:      scottl (stable/9 backport), pho
DeltaFile
+29-18sys/kern/uipc_syscalls.c
+29-181 files

UnifiedSplitRaw