summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2008-08-11 08:14:55 +0100
committerRichard Hughes <richard@hughsie.com>2008-08-11 08:14:55 +0100
commit40b0fa5d177129a09f62a4bff4efdc6af77b8a8a (patch)
tree72ea6733c90357da1104a8170e5cebbf15a08c58
parent6c434239298c70f531201bfd0d556d557474befb (diff)
Abort in DkpCsr if we can't read the bus or dev numbers
-rw-r--r--src/dkp-csr.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/dkp-csr.c b/src/dkp-csr.c
index 374fc21..c08f687 100644
--- a/src/dkp-csr.c
+++ b/src/dkp-csr.c
@@ -163,6 +163,13 @@ dkp_csr_coldplug (DkpDevice *device)
csr->priv->bus_num = sysfs_get_int (obj->native_path, "busnum");
csr->priv->dev_num = sysfs_get_int (obj->native_path, "devnum");
+ /* get correct bus numbers? */
+ if (csr->priv->bus_num == 0 || csr->priv->dev_num == 0) {
+ dkp_warning ("unable to get bus or device numbers");
+ ret = FALSE;
+ goto out;
+ }
+
/* get optional quirk parameters */
ret = devkit_device_has_property (d, "ID_CSR_HAS_SMS");
if (ret)
@@ -217,6 +224,11 @@ dkp_csr_refresh (DkpDevice *device)
/* Which of subdevices to address */
addr = csr->priv->is_dual ? 1<<8 : 0;
+ if (csr->priv->device == NULL) {
+ dkp_warning ("no device!");
+ return FALSE;
+ }
+
/* open USB device */
handle = usb_open (csr->priv->device);
if (handle == NULL) {