brymen-bm86x: add some error checking
This commit is contained in:
parent
c442ffda0f
commit
6d930b4159
|
@ -109,6 +109,8 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
|
||||
if ((ret = sr_usb_open(drvc->sr_ctx->libusb_ctx, usb)) == SR_OK)
|
||||
sdi->status = SR_ST_ACTIVE;
|
||||
else
|
||||
return SR_ERR;
|
||||
|
||||
/* Detach kernel drivers which grabbed this device (if any). */
|
||||
if (libusb_kernel_driver_active(usb->devhdl, 0) == 1) {
|
||||
|
@ -141,6 +143,9 @@ static int dev_close(struct sr_dev_inst *sdi)
|
|||
struct dev_context *devc;
|
||||
int ret;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
usb = sdi->conn;
|
||||
devc = sdi->priv;
|
||||
|
||||
|
|
Loading…
Reference in New Issue