]> git.proxmox.com Git - mirror_zfs.git/commit - module/zfs/spa.c
Refactor spa_load_l2cache to make build happy
authorNikolay Borisov <n.borisov.lkml@gmail.com>
Sat, 10 Sep 2016 20:06:17 +0000 (23:06 +0300)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 12 Sep 2016 19:40:03 +0000 (12:40 -0700)
commit67d60824946ade6b1b71a98dbfbfca5949aee425
treef55cb2ea00ca84d5b35a2a3e9b83ca1fe6d0313a
parent20aa7a4e319ddf53e4e2dcc5fa9b3b1645e982e3
Refactor spa_load_l2cache to make build happy

In case sav->sav_config was NULL the body of the function
would skip the iteration of the l2 cache devices and will
just cleanup the old devices. However, this wasn't very obvious
since the null check was performed after the loop body and after
the old devices were cleaned. Refactor the code so that it's now
obvious when the iteration of the l2cache devices is skipped.

This fixes the following cppcheck warning:

[module/zfs/spa.c:1552]: (error) Possible null pointer dereference: newvdevs

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
Closes #5087
module/zfs/spa.c