libblkid: remove various no-op variable checks
* These cause warning errors since they will always evaluate to true
Change-Id: Iecdacc40807095893af357a962e238a3d263ca5a
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
index 76ac099..b2e7435 100644
--- a/libblkid/src/probe.c
+++ b/libblkid/src/probe.c
@@ -355,9 +355,6 @@
int rc, org_prob_flags;
struct blkid_chain *org_chn;
- if (!pr || !chn)
- return NULL;
-
/* save the current setting -- the binary API has to be completely
* independent on the current probing status
*/
@@ -445,7 +442,7 @@
{
struct blkid_chain *chn;
- if (!pr || chain < 0 || chain >= BLKID_NCHAINS)
+ if (chain < 0 || chain >= BLKID_NCHAINS)
return NULL;
chn = &pr->chains[chain];
@@ -476,9 +473,6 @@
size_t i;
struct blkid_chain *chn;
- if (!pr)
- return -1;
-
chn = &pr->chains[chain];
if (!chn->driver->has_fltr || !chn->fltr)
@@ -647,7 +641,7 @@
*/
int blkid_probe_is_tiny(blkid_probe pr)
{
- return pr && (pr->flags & BLKID_FL_TINY_DEV);
+ return pr->flags & BLKID_FL_TINY_DEV;
}
/*
@@ -655,7 +649,7 @@
*/
int blkid_probe_is_cdrom(blkid_probe pr)
{
- return pr && (pr->flags & BLKID_FL_CDROM_DEV);
+ return pr->flags & BLKID_FL_CDROM_DEV;
}
/**
@@ -767,9 +761,6 @@
int blkid_probe_get_dimension(blkid_probe pr,
blkid_loff_t *off, blkid_loff_t *size)
{
- if (!pr)
- return -1;
-
*off = pr->off;
*size = pr->size;
return 0;
@@ -778,9 +769,6 @@
int blkid_probe_set_dimension(blkid_probe pr,
blkid_loff_t off, blkid_loff_t size)
{
- if (!pr)
- return -1;
-
DBG(LOWPROBE, ul_debug(
"changing probing area pr=%p: size=%llu, off=%llu "
"-to-> size=%llu, off=%llu",
@@ -1275,8 +1263,6 @@
{
struct blkid_prval *v;
- if (!name)
- return NULL;
if (pr->nvals >= BLKID_NVALS)
return NULL;
@@ -1293,7 +1279,7 @@
{
struct blkid_prval *v;
- if (pr == NULL || pr->nvals == 0)
+ if (pr->nvals == 0)
return -1;
v = &pr->vals[pr->nvals - 1];
@@ -1363,7 +1349,7 @@
int rc = 0;
struct blkid_chain *chn = blkid_probe_get_chain(pr);
- if (!chn || !magic || !len || chn->binary)
+ if (!chn || !len || chn->binary)
return 0;
switch (chn->driver->id) {
@@ -1665,7 +1651,7 @@
struct blkid_prval *__blkid_probe_get_value(blkid_probe pr, int num)
{
- if (!pr || num < 0 || num >= pr->nvals)
+ if (num < 0 || num >= pr->nvals)
return NULL;
return &pr->vals[num];
@@ -1675,7 +1661,7 @@
{
int i;
- if (!pr || !pr->nvals || !name)
+ if (!pr->nvals)
return NULL;
for (i = 0; i < pr->nvals; i++) {
@@ -1772,9 +1758,6 @@
{
struct blkid_chain *chn;
- if (!pr)
- return;
-
if (!size) {
DBG(LOWPROBE, ul_debug("zeroize wiper"));
pr->wipe_size = pr->wipe_off = 0;
@@ -1806,12 +1789,11 @@
int blkid_probe_is_wiped(blkid_probe pr, struct blkid_chain **chn,
blkid_loff_t off, blkid_loff_t size)
{
- if (!pr || !size)
+ if (!size)
return 0;
if (pr->wipe_off <= off && off + size <= pr->wipe_off + pr->wipe_size) {
- if (chn)
- *chn = pr->wipe_chain;
+ *chn = pr->wipe_chain;
return 1;
}
return 0;
diff --git a/libblkid/src/read.c b/libblkid/src/read.c
index 81ab0df..99a9684 100644
--- a/libblkid/src/read.c
+++ b/libblkid/src/read.c
@@ -402,9 +402,6 @@
int fd, lineno = 0;
struct stat st;
- if (!cache)
- return;
-
/*
* If the file doesn't exist, then we just return an empty
* struct so that the cache can be populated.
diff --git a/libblkid/src/save.c b/libblkid/src/save.c
index c2a9753..bdc9c59 100644
--- a/libblkid/src/save.c
+++ b/libblkid/src/save.c
@@ -85,9 +85,6 @@
int fd, ret = 0;
struct stat st;
- if (!cache)
- return -BLKID_ERR_PARAM;
-
if (list_empty(&cache->bic_devs) ||
!(cache->bic_flags & BLKID_BIC_FL_CHANGED)) {
DBG(SAVE, ul_debug("skipping cache file write"));
diff --git a/libblkid/src/tag.c b/libblkid/src/tag.c
index 6af8062..a59c0e6 100644
--- a/libblkid/src/tag.c
+++ b/libblkid/src/tag.c
@@ -66,9 +66,6 @@
{
struct list_head *p;
- if (!dev || !type)
- return NULL;
-
list_for_each(p, &dev->bid_tags) {
blkid_tag tmp = list_entry(p, struct blkid_struct_tag,
bit_tags);
@@ -127,9 +124,6 @@
char *val = 0;
char **dev_var = 0;
- if (!dev || !name)
- return -BLKID_ERR_PARAM;
-
if (value && !(val = strndup(value, vlength)))
return -BLKID_ERR_MEM;