1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cleanup: add some test for NULL

Coverity here is a bit 'blind' here and cannot resolve which
code paths are actually able to hit this code path.
(It's using 'statistic' to resolve all possible paths,
and it's not scanning 'individual' code paths.)

This just cleans warns and add 'cheap' tests.
This commit is contained in:
Zdenek Kabelac 2015-11-17 13:21:22 +01:00
parent 011dd82050
commit d8049dd17a

View File

@ -2254,7 +2254,7 @@ static int _lv_postorder_cleanup(struct logical_volume *lv, void *data)
static int _lv_postorder_level(struct logical_volume *lv, void *data)
{
struct _lv_postorder_baton *baton = data;
return _lv_postorder_visit(lv, baton->fn, baton->data);
return (data) ? _lv_postorder_visit(lv, baton->fn, baton->data) : 0;
};
static int _lv_postorder_visit(struct logical_volume *lv,
@ -2346,7 +2346,7 @@ struct _lv_mark_if_partial_baton {
static int _lv_mark_if_partial_collect(struct logical_volume *lv, void *data)
{
struct _lv_mark_if_partial_baton *baton = data;
if (lv->status & PARTIAL_LV)
if (baton && lv->status & PARTIAL_LV)
baton->partial = 1;
return 1;