utils: ipu3: Abort when sensor or media device isn't found

Calling exit from a function only exits from the function, it doesn't
abort the whole script. Propagate the errors to stop operation when the
sensor or media device can't be found.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2018-12-11 00:31:24 +02:00
parent ad8934db5b
commit 0d96f3e232
2 changed files with 9 additions and 13 deletions

View file

@ -20,7 +20,8 @@ find_sensor() {
bus=$(grep "$sensor_name" /sys/class/video4linux/v4l-subdev*/name | cut -d ' ' -f 2)
if [[ -z $bus ]]; then
return
echo "Sensor '$sensor_name' not found." >&2
exit 1
fi
echo "$sensor_name $bus"
@ -170,13 +171,8 @@ fi
sensor_name=$1
sensor=$(find_sensor $sensor_name)
if [[ -z $sensor ]] ; then
echo "Sensor '$sensor_name' not found." >&2
exit 1
fi
mdev=$(find_media_device)
sensor=$(find_sensor $sensor_name) || exit
mdev=$(find_media_device) || exit
mediactl="media-ctl -d $mdev"
parse_pipeline $sensor

View file

@ -173,7 +173,7 @@ fi
out_size=${out_size:-$in_size}
vf_size=${vf_size:-$in_size}
mdev=$(find_media_device)
mdev=$(find_media_device) || exit
mediactl="media-ctl -d $mdev"
echo "Using device $mdev"