mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-24 18:39:34 +03:00
cppcheck: (error) Uninitialized variable
As of cppcheck 1.82 warnings are issued when using the list_for_each_* functions with an uninitialized variable. Functionally, this is fine but to resolve the warning initialize these variables. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #9732
This commit is contained in:
parent
bf01567e4e
commit
363d7332f2
@ -649,7 +649,7 @@ static void __init
|
||||
spl_random_init(void)
|
||||
{
|
||||
uint64_t s[2];
|
||||
int i;
|
||||
int i = 0;
|
||||
|
||||
get_random_bytes(s, sizeof (s));
|
||||
|
||||
|
@ -312,7 +312,7 @@ static spl_kmem_slab_t *
|
||||
spl_slab_alloc(spl_kmem_cache_t *skc, int flags)
|
||||
{
|
||||
spl_kmem_slab_t *sks;
|
||||
spl_kmem_obj_t *sko, *n;
|
||||
spl_kmem_obj_t *sko;
|
||||
void *base, *obj;
|
||||
uint32_t obj_size, offslab_size = 0;
|
||||
int i, rc = 0;
|
||||
@ -356,6 +356,7 @@ spl_slab_alloc(spl_kmem_cache_t *skc, int flags)
|
||||
|
||||
out:
|
||||
if (rc) {
|
||||
spl_kmem_obj_t *n = NULL;
|
||||
if (skc->skc_flags & KMC_OFFSLAB)
|
||||
list_for_each_entry_safe(sko,
|
||||
n, &sks->sks_free_list, sko_list) {
|
||||
@ -405,8 +406,8 @@ spl_slab_free(spl_kmem_slab_t *sks,
|
||||
static void
|
||||
spl_slab_reclaim(spl_kmem_cache_t *skc)
|
||||
{
|
||||
spl_kmem_slab_t *sks, *m;
|
||||
spl_kmem_obj_t *sko, *n;
|
||||
spl_kmem_slab_t *sks = NULL, *m = NULL;
|
||||
spl_kmem_obj_t *sko = NULL, *n = NULL;
|
||||
LIST_HEAD(sks_list);
|
||||
LIST_HEAD(sko_list);
|
||||
uint32_t size = 0;
|
||||
@ -802,7 +803,7 @@ spl_magazine_free(spl_kmem_magazine_t *skm)
|
||||
static int
|
||||
spl_magazine_create(spl_kmem_cache_t *skc)
|
||||
{
|
||||
int i;
|
||||
int i = 0;
|
||||
|
||||
if (skc->skc_flags & KMC_NOMAGAZINE)
|
||||
return (0);
|
||||
@ -833,7 +834,7 @@ static void
|
||||
spl_magazine_destroy(spl_kmem_cache_t *skc)
|
||||
{
|
||||
spl_kmem_magazine_t *skm;
|
||||
int i;
|
||||
int i = 0;
|
||||
|
||||
if (skc->skc_flags & KMC_NOMAGAZINE)
|
||||
return;
|
||||
@ -1617,7 +1618,7 @@ static spl_shrinker_t
|
||||
__spl_kmem_cache_generic_shrinker(struct shrinker *shrink,
|
||||
struct shrink_control *sc)
|
||||
{
|
||||
spl_kmem_cache_t *skc;
|
||||
spl_kmem_cache_t *skc = NULL;
|
||||
int alloc = 0;
|
||||
|
||||
/*
|
||||
|
@ -303,7 +303,7 @@ kmem_del_init(spinlock_t *lock, struct hlist_head *table,
|
||||
int bits, const void *addr)
|
||||
{
|
||||
struct hlist_head *head;
|
||||
struct hlist_node *node;
|
||||
struct hlist_node *node = NULL;
|
||||
struct kmem_debug *p;
|
||||
unsigned long flags;
|
||||
|
||||
@ -500,7 +500,7 @@ static void
|
||||
spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock)
|
||||
{
|
||||
unsigned long flags;
|
||||
kmem_debug_t *kd;
|
||||
kmem_debug_t *kd = NULL;
|
||||
char str[17];
|
||||
|
||||
spin_lock_irqsave(lock, flags);
|
||||
|
@ -431,7 +431,7 @@ static struct seq_operations kstat_seq_ops = {
|
||||
static kstat_module_t *
|
||||
kstat_find_module(char *name)
|
||||
{
|
||||
kstat_module_t *module;
|
||||
kstat_module_t *module = NULL;
|
||||
|
||||
list_for_each_entry(module, &kstat_module_list, ksm_module_list) {
|
||||
if (strncmp(name, module->ksm_name, KSTAT_STRLEN) == 0)
|
||||
@ -624,7 +624,7 @@ static int
|
||||
kstat_detect_collision(kstat_proc_entry_t *kpep)
|
||||
{
|
||||
kstat_module_t *module;
|
||||
kstat_proc_entry_t *tmp;
|
||||
kstat_proc_entry_t *tmp = NULL;
|
||||
char *parent;
|
||||
char *cp;
|
||||
|
||||
@ -659,7 +659,7 @@ kstat_proc_entry_install(kstat_proc_entry_t *kpep, mode_t mode,
|
||||
const struct file_operations *file_ops, void *data)
|
||||
{
|
||||
kstat_module_t *module;
|
||||
kstat_proc_entry_t *tmp;
|
||||
kstat_proc_entry_t *tmp = NULL;
|
||||
|
||||
ASSERT(kpep);
|
||||
|
||||
|
@ -144,7 +144,7 @@ proc_doslab(struct ctl_table *table, int write,
|
||||
int rc = 0;
|
||||
unsigned long min = 0, max = ~0, val = 0, mask;
|
||||
spl_ctl_table dummy = *table;
|
||||
spl_kmem_cache_t *skc;
|
||||
spl_kmem_cache_t *skc = NULL;
|
||||
|
||||
dummy.data = &val;
|
||||
dummy.proc_handler = &proc_dointvec;
|
||||
@ -249,7 +249,7 @@ static int
|
||||
taskq_seq_show_impl(struct seq_file *f, void *p, boolean_t allflag)
|
||||
{
|
||||
taskq_t *tq = p;
|
||||
taskq_thread_t *tqt;
|
||||
taskq_thread_t *tqt = NULL;
|
||||
spl_wait_queue_entry_t *wq;
|
||||
struct task_struct *tsk;
|
||||
taskq_ent_t *tqe;
|
||||
|
@ -82,7 +82,7 @@ task_km_flags(uint_t flags)
|
||||
static int
|
||||
taskq_find_by_name(const char *name)
|
||||
{
|
||||
struct list_head *tql;
|
||||
struct list_head *tql = NULL;
|
||||
taskq_t *tq;
|
||||
|
||||
list_for_each_prev(tql, &tq_list) {
|
||||
@ -211,7 +211,7 @@ task_expire_impl(taskq_ent_t *t)
|
||||
{
|
||||
taskq_ent_t *w;
|
||||
taskq_t *tq = t->tqent_taskq;
|
||||
struct list_head *l;
|
||||
struct list_head *l = NULL;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class);
|
||||
@ -298,7 +298,7 @@ static void
|
||||
taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt)
|
||||
{
|
||||
taskq_thread_t *w;
|
||||
struct list_head *l;
|
||||
struct list_head *l = NULL;
|
||||
|
||||
ASSERT(tq);
|
||||
ASSERT(tqt);
|
||||
@ -321,7 +321,7 @@ taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt)
|
||||
static taskq_ent_t *
|
||||
taskq_find_list(taskq_t *tq, struct list_head *lh, taskqid_t id)
|
||||
{
|
||||
struct list_head *l;
|
||||
struct list_head *l = NULL;
|
||||
taskq_ent_t *t;
|
||||
|
||||
list_for_each(l, lh) {
|
||||
@ -347,7 +347,7 @@ static taskq_ent_t *
|
||||
taskq_find(taskq_t *tq, taskqid_t id)
|
||||
{
|
||||
taskq_thread_t *tqt;
|
||||
struct list_head *l;
|
||||
struct list_head *l = NULL;
|
||||
taskq_ent_t *t;
|
||||
|
||||
t = taskq_find_list(tq, &tq->tq_delay_list, id);
|
||||
@ -1198,7 +1198,7 @@ param_set_taskq_kick(const char *val, struct kernel_param *kp)
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
taskq_t *tq;
|
||||
taskq_t *tq = NULL;
|
||||
taskq_ent_t *t;
|
||||
unsigned long flags;
|
||||
|
||||
|
@ -98,7 +98,7 @@ static tsd_hash_table_t *tsd_hash_table = NULL;
|
||||
static tsd_hash_entry_t *
|
||||
tsd_hash_search(tsd_hash_table_t *table, uint_t key, pid_t pid)
|
||||
{
|
||||
struct hlist_node *node;
|
||||
struct hlist_node *node = NULL;
|
||||
tsd_hash_entry_t *entry;
|
||||
tsd_hash_bin_t *bin;
|
||||
ulong_t hash;
|
||||
|
@ -50,7 +50,7 @@ EXPORT_SYMBOL(zio_arena);
|
||||
size_t
|
||||
vmem_size(vmem_t *vmp, int typemask)
|
||||
{
|
||||
spl_kmem_cache_t *skc;
|
||||
spl_kmem_cache_t *skc = NULL;
|
||||
size_t alloc = VMEM_FLOOR_SIZE;
|
||||
|
||||
if ((typemask & VMEM_ALLOC) && (typemask & VMEM_FREE))
|
||||
|
Loading…
Reference in New Issue
Block a user