drivers: pinctrl: fix lookup when there are no states
drivers: pinctrl: fix lookup when there are no states

Right now it is possible that some devices define 0 pinctrl states in
devicetree, because pinctrl-N entries may still be optional for backward
compatibility. If the programmer makes a mistake and forgets them,
application could experience runtime crashes because
pinctrl_lookup_states assumes you have at least one state, so it does
not perform any bounds checking. Change the while condition so that it
is skipped if states count is zero.

Signed-off-by: Gerard Marull-Paretas <bedb45f43a286e49f4dcda039a436b216ae61ef3@nordicsemi.no>

zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,galak/zephyr,galak/zephyr,galak/zephyr,galak/zephyr