Commit f0523be4 authored by Sergio Rodriguez's avatar Sergio Rodriguez Committed by Anas Nashif
Browse files

samples: drivers: gpio: Exit from testcase if device not found


Exiting from the test case when the gpio device is not found, this
to avoid a null pointer dereference

This issue was reported by Coverity

Coverity-CID: 151980

Change-Id: I44f13131d44c7c093781e1f11f8481e7ef8175c9
Signed-off-by: default avatarSergio Rodriguez <sergio.sf.rodriguez@intel.com>
parent db089efe
Showing with 1 addition and 0 deletions
+1 -0
......@@ -161,6 +161,7 @@ void main(void)
gpio_dev = device_get_binding(GPIO_DRV_NAME);
if (!gpio_dev) {
printk("Cannot find %s!\n", GPIO_DRV_NAME);
return;
}
/* Setup GPIO output */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment