kernel: delayed_work: fix race condition in k_delayed_work_cancel
kernel: delayed_work: fix race condition in k_delayed_work_cancel

The implementation checks the work queue pointer before taking a lock
and entering code that, depending on build options, may fault if that
pointer is null.  Move the check under the lock to ensure condition is
preserved.  Then the check in work_cancel is no longer necessary since
condition is verified under lock at all call sites.

Signed-off-by: Peter Bigot <a4112a160b558d5427af084318038e19a95979ee@nordicsemi.no>

nashif/zephyr,finikorg/zephyr,zephyrproject-rtos/zephyr,Vudentz/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,nashif/zephyr,galak/zephyr,Vudentz/zephyr,galak/zephyr,galak/zephyr,finikorg/zephyr,nashif/zephyr,Vudentz/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,finikorg/zephyr,Vudentz/zephyr,Vudentz/zephyr,zephyrproject-rtos/zephyr,nashif/zephyr,Vudentz/zephyr,finikorg/zephyr,finikorg/zephyr,nashif/zephyr,zephyrproject-rtos/zephyr