From: Spencer Oliver Date: Tue, 22 Apr 2014 19:53:50 +0000 (+0100) Subject: nrf51: remove dereference of null pointer X-Git-Tag: v0.8.0~1 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=cf094f22ca1088dad99c85d10adf95979ed41176 nrf51: remove dereference of null pointer found by clang 3.4. Change-Id: Id499b546f65acd7a719498bc97e33b21d1ba565a Signed-off-by: Spencer Oliver Reviewed-on: http://openocd.zylin.com/2119 Tested-by: jenkins Reviewed-by: Andreas Fritiofson Reviewed-by: Andrey Smirnov --- diff --git a/src/flash/nor/nrf51.c b/src/flash/nor/nrf51.c index 2a4b88764e..adb4004d98 100644 --- a/src/flash/nor/nrf51.c +++ b/src/flash/nor/nrf51.c @@ -629,7 +629,7 @@ static int nrf51_write_page(struct flash_bank *bank, uint32_t offset, const uint struct flash_sector *sector = nrf51_find_sector_by_address(bank, offset); if (!sector) - goto error; + return ERROR_FLASH_SECTOR_INVALID; if (sector->is_protected) goto error;