target/cortex_m: prevent segmentation fault in cortex_m_poll()