samples: button: stop the app if device binding fails

Stop the app from running if device binding fails. Otherwise,
dereferencing NULL pointer will happen. This was caught by
Coverity.

Coverity-CID: 151988

Change-Id: I8245d938498a51123249fbd069935900ad660314
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
This commit is contained in:
Baohong Liu 2016-11-17 16:47:57 -08:00 committed by Anas Nashif
parent 8d2a511557
commit 2ca689da91

View file

@ -62,6 +62,7 @@ void main(void)
gpiob = device_get_binding(PORT);
if (!gpiob) {
printk("error\n");
return;
}
gpio_pin_configure(gpiob, PIN,