]> sigrok.org Git - libsigrok.git/commitdiff
dev_open(): Don't check for sdi != NULL.
authorUwe Hermann <redacted>
Sat, 23 Apr 2016 18:58:46 +0000 (20:58 +0200)
committerUwe Hermann <redacted>
Fri, 29 Apr 2016 17:26:17 +0000 (19:26 +0200)
The wrapper guarantees that sdi is not NULL.

src/hardware/chronovu-la/api.c
src/hardware/hp-3457a/api.c
src/hardware/zeroplus-logic-cube/api.c

index d8de0da1f96f655965174da40491fda2419017db..040a9c4b087f66b2c87c40555ada19a5ce78025a 100644 (file)
@@ -255,8 +255,7 @@ static int dev_open(struct sr_dev_inst *sdi)
        struct dev_context *devc;
        int ret;
 
-       if (!(devc = sdi->priv))
-               return SR_ERR_BUG;
+       devc = sdi->priv;
 
        /* Allocate memory for the FTDI context and initialize it. */
        if (!(devc->ftdic = ftdi_new())) {
index 05a45e6295905f7ef31086b14b6e5fb114a620c0..b152be9236427aafa61f02fcfc051c18d8128852 100644 (file)
@@ -213,7 +213,7 @@ static int dev_open(struct sr_dev_inst *sdi)
        if (sr_scpi_open(scpi) != SR_OK)
                return SR_ERR;
 
-       devc=sdi->priv;
+       devc = sdi->priv;
 
        sr_scpi_send(scpi, "PRESET");
        sr_scpi_send(scpi, "INBUF ON");
index c85a40892b69a297317d67c6267bfe0552c3f4d9..22e949c98ad98d90ec51c4174cbf5750daae6d4f 100644 (file)
@@ -273,11 +273,7 @@ static int dev_open(struct sr_dev_inst *sdi)
 
        drvc = di->context;
        usb = sdi->conn;
-
-       if (!(devc = sdi->priv)) {
-               sr_err("%s: sdi->priv was NULL", __func__);
-               return SR_ERR_ARG;
-       }
+       devc = sdi->priv;
 
        device_count = libusb_get_device_list(drvc->sr_ctx->libusb_ctx,
                                              &devlist);