Skip to content

Commit

Permalink
driver: px4_device: fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nns779 committed Jun 27, 2021
1 parent 6f4bae2 commit 3e02c78
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions driver/px4_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,10 @@ static int px4_chrdev_open(struct ptx_chrdev *chrdev)
px4_backend_term(px4);

fail_backend_init:
if (!px4->open_count) {
if (px4->mldev)
px4_mldev_set_power(px4->mldev, px4, chrdev->id, false, NULL);
else
px4_backend_set_power(px4, false);
}
if (px4->mldev)
px4_mldev_set_power(px4->mldev, px4, chrdev->id, false, NULL);
else if (!px4->open_count)
px4_backend_set_power(px4, false);

fail_backend_power:
mutex_unlock(&px4->lock);
Expand Down

0 comments on commit 3e02c78

Please sign in to comment.