Skip to content

Commit

Permalink
sensor: shell: return -ENODEV on binding errors
Browse files Browse the repository at this point in the history
If we can't bind to a device, return -ENODEV and do not continue.

Fixes #22429
Coverity-ID: 207989

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
  • Loading branch information
nashif committed Mar 10, 2020
1 parent 22b6a4c commit ab6179c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/sensor/sensor_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ static int cmd_get_sensor(const struct shell *shell, size_t argc, char *argv[])
dev = device_get_binding(argv[1]);
if (dev == NULL) {
shell_error(shell, "Device unknown (%s)", argv[1]);
return -ENODEV;
}

err = sensor_sample_fetch(dev);
Expand Down

0 comments on commit ab6179c

Please sign in to comment.