if (!devno)
continue;
- sysfs_init(&sysfs, devno, NULL);
- sysfs_read_int(&sysfs, "removable", &removable);
- sysfs_deinit(&sysfs);
+ if (sysfs_init(&sysfs, devno, NULL) == 0) {
+ sysfs_read_int(&sysfs, "removable", &removable);
+ sysfs_deinit(&sysfs);
+ }
if (removable)
probe_one(cache, d->d_name, devno, 0, 0, 1);
struct sysfs_cxt cxt;
int is_part = 0;
- if (!dev)
- goto err;
- if (sysfs_init(&cxt, dev, NULL))
- goto err;
+ if (!dev || sysfs_init(&cxt, dev, NULL) != 0)
+ return -1;
is_part = sysfs_has_attribute(&cxt, "partition");
if (!is_part) {
static int probe_sysfs_tp(blkid_probe pr, const struct blkid_idmag *mag)
{
dev_t dev, disk = 0;
- int i, count = 0;
+ int i, count = 0, rc;
struct sysfs_cxt sysfs, parent;
- int rc = 1; /* nothing (default) */
-
dev = blkid_probe_get_devno(pr);
- if (!dev)
- goto done; /* probably not a block device */
- if (sysfs_init(&sysfs, dev, NULL))
- goto done; /* no entry in /sys ? */
+ if (!dev || sysfs_init(&sysfs, dev, NULL) != 0)
+ return 1;
+
+ rc = 1; /* nothing (default) */
for (i = 0; i < ARRAY_SIZE(topology_vals); i++) {
struct topology_val *val = &topology_vals[i];
*/
disk = blkid_probe_get_wholedisk_devno(pr);
if (disk && disk != dev) {
- sysfs_init(&parent, disk, NULL);
- sysfs.parent = &parent;
+ if (sysfs_init(&parent, disk, NULL) != 0)
+ goto done;
- ok = sysfs_has_attribute(&sysfs, val->attr);
+ sysfs.parent = &parent;
+ ok = sysfs_has_attribute(&sysfs,
+ val->attr);
}
}
if (!ok)