- if (device->plugin && device->plugin->close)
- device->plugin->close(device->plugin_index);
- device_destroy(device);
+ if (device->plugin && device->plugin->closedev) {
+ ret = device->plugin->closedev(device->plugin_index);
+ if (ret != SR_OK) {
+ sr_err("dev: %s: could not close device %d",
+ __func__, device->plugin_index);
+ }
+ }
+ sr_device_destroy(device);