Use the same logic as in OSDMap::pg_to_raw_up().
Fix for:
[src/osd/OSDMap.cc:2071] -> [src/osd/OSDMap.cc:2077]: (warning) Either the
condition 'if(primary)' is redundant or there is possible null pointer
dereference: primary.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
void OSDMap::pg_to_raw_osds(pg_t pg, vector<int> *raw, int *primary) const
{
- *primary = -1;
- raw->clear();
const pg_pool_t *pool = get_pg_pool(pg.pool());
- if (!pool)
+ if (!pool) {
+ if (primary)
+ *primary = -1;
+ if (raw)
+ raw->clear();
return;
+ }
_pg_to_raw_osds(*pool, pg, raw, NULL);
- if (primary)
- *primary = _pick_primary(*raw);
+ *primary = _pick_primary(*raw);
}
void OSDMap::pg_to_raw_up(pg_t pg, vector<int> *up, int *primary) const