src/flash/nor/virtual: handle null pointers 82/5782/5
authorChristopher Head <chead@zaber.com>
Fri, 17 Jul 2020 21:44:35 +0000 (14:44 -0700)
committerTomas Vanek <vanekt@fbl.cz>
Sun, 9 Aug 2020 14:30:23 +0000 (15:30 +0100)
commit6ec2ec4d32e554a97c057e3f2f0839679f7e6291
treee5968432a351b142fc5d617097c1cfa23bb17f3c
parent37eac2dfbccf1a32ef598c1cf9e0e485147f9f71
src/flash/nor/virtual: handle null pointers

Either of protect and protect_check driver callbacks can be NULL. In
virtual_protect, reuse flash_driver_protect which checks for that case
and generates a nice error message and return code. In
virtual_protect_check, there is no corresponding flash_driver_*
function, so add the NULL check directly.

Change-Id: Ia63d85ede640a8382cf5cad0760f5d1ffe4d7cfe
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5782
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
src/flash/nor/virtual.c