Skip to content

Commit

Permalink
samples: grove_lcd: stop the app if device binding fails
Browse files Browse the repository at this point in the history
Proceed to LCD programming only if device binding succeeds.
Otherwise, dereferencing a NULL pointer will happen. This
was caught by Coverity.

Coverity-CID: 151986

Change-Id: Ibdb658f530203428aa3e53f358e0788fc1502b06
Signed-off-by: Baohong Liu <[email protected]>
  • Loading branch information
bliu11-intel authored and Anas Nashif committed Nov 18, 2016
1 parent 0ad8f51 commit 5e892b7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions samples/grove/lcd/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ void main(void)
glcd = device_get_binding(GROVE_LCD_NAME);
if (!glcd) {
printk("Grove LCD: Device not found.\n");
return;
}

/* Now configure the LCD the way we want it */
Expand Down

0 comments on commit 5e892b7

Please sign in to comment.