drivers: flash: sam: fix flash erase last page

The implementation for erasing pages in the flash_sam.c driver
indicated a successful erase after exceeding the last page to be
erased successfully. Since the last page has no proceeding page,
the succeeded status was not set.

This fix switches around the status to be set as succeeded before
erase begins, to have the succeeded status cleared if page unlock
or erase fails.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
1 file changed