From ea7893bb397949c1c3c798ed5d643445f3fa5205 Mon Sep 17 00:00:00 2001 From: Radek Dostal Date: Sun, 27 Jul 2014 23:22:57 +0200 Subject: [PATCH] staging: lustre: fix sparse warnings "Using plain integer as NULL pointer" fixes all sparse warnings "Using plain integer as NULL pointer" in drivers/staging/lustre drivers/staging/lustre/lnet/lnet/api-ni.c:1665:32: warning: Using plain integer as NULL pointer drivers/staging/lustre/lnet/lnet/api-ni.c:1773:35: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/fld/fld_request.c:171:17: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/llite/llite_lib.c:155:30: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/llite/lproc_llite.c:846:11: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/lov/lov_obd.c:902:48: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/lov/lov_obd.c:946:54: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/lov/lov_obd.c:2819:46: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/lov/lov_dev.c:456:66: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/mdc_request.c:2426:46: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/mdc_request.c:2569:46: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/mdc_request.c:2740:46: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:175:57: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:176:57: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:177:57: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:178:57: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:179:57: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:180:57: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:181:57: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:182:57: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:183:57: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:185:57: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:186:57: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:193:66: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:194:63: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:195:56: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:196:51: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:197:50: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:198:48: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:199:57: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:200:11: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:206:48: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mdc/lproc_mdc.c:207:11: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/mgc/mgc_request.c:199:9: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/obdclass/linux/linux-module.c:331:11: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/obdclass/obd_config.c:1164:53: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/obdclass/obd_config.c:1306:71: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/obdclass/llog_test.c:943:62: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/obdclass/llog_test.c:944:65: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/obdecho/echo_client.c:3116:46: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/osc/osc_request.c:3424:46: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/osc/osc_request.c:3548:46: warning: Using plain integer as NULL pointer drivers/staging/lustre/lustre/osc/osc_request.c:3615:46: warning: Using plain integer as NULL pointer Signed-off-by: Radek Dostal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/api-ni.c | 4 +- .../staging/lustre/lustre/fld/fld_request.c | 2 +- .../staging/lustre/lustre/llite/llite_lib.c | 2 +- .../staging/lustre/lustre/llite/lproc_llite.c | 2 +- drivers/staging/lustre/lustre/lov/lov_dev.c | 2 +- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 44 +++++++++---------- .../staging/lustre/lustre/mdc/mdc_request.c | 6 +-- .../staging/lustre/lustre/mgc/mgc_request.c | 2 +- .../lustre/obdclass/linux/linux-module.c | 2 +- .../lustre/lustre/obdclass/llog_test.c | 4 +- .../lustre/lustre/obdclass/obd_config.c | 6 +-- .../lustre/lustre/obdecho/echo_client.c | 2 +- .../staging/lustre/lustre/osc/osc_request.c | 6 +-- 13 files changed, 42 insertions(+), 42 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index f4a2c65d3c48..b28734a76fac 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -1662,7 +1662,7 @@ lnet_destroy_ping_info(void) int lnet_ping_target_init(void) { - lnet_md_t md = {0}; + lnet_md_t md = { NULL }; lnet_handle_me_t meh; lnet_process_id_t id; int rc; @@ -1770,7 +1770,7 @@ lnet_ping (lnet_process_id_t id, int timeout_ms, lnet_process_id_t *ids, int n_i lnet_handle_eq_t eqh; lnet_handle_md_t mdh; lnet_event_t event; - lnet_md_t md = {0}; + lnet_md_t md = { NULL }; int which; int unlinked = 0; int replied = 0; diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index 4efded9485f8..8e512f9c3db0 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -168,7 +168,7 @@ struct lu_fld_hash fld_hash[] = { .fh_scan_func = fld_rrb_scan }, { - 0, + NULL, } }; diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index e0d8f15fe4fd..0367f5a2cfe4 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -152,7 +152,7 @@ static void ll_free_sbi(struct super_block *sb) static int client_common_fill_super(struct super_block *sb, char *md, char *dt, struct vfsmount *mnt) { - struct inode *root = 0; + struct inode *root = NULL; struct ll_sb_info *sbi = ll_s2sbi(sb); struct obd_device *obd; struct obd_capa *oc = NULL; diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index 13586c55b570..77f68b507fea 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -843,7 +843,7 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = { { "default_cookiesize", &ll_defult_cookiesize_fops, NULL, 0 }, { "sbi_flags", &ll_sbi_flags_fops, NULL, 0 }, { "xattr_cache", &ll_xattr_cache_fops, NULL, 0 }, - { 0 } + { NULL } }; #define MAX_STRING_SIZE 128 diff --git a/drivers/staging/lustre/lustre/lov/lov_dev.c b/drivers/staging/lustre/lustre/lov/lov_dev.c index e6d14135ffe6..796a015d070c 100644 --- a/drivers/staging/lustre/lustre/lov/lov_dev.c +++ b/drivers/staging/lustre/lustre/lov/lov_dev.c @@ -453,7 +453,7 @@ static int lov_process_config(const struct lu_env *env, case LCFG_LOV_ADD_INA: rc = lov_cl_add_target(env, d, index); if (rc != 0) - lov_del_target(d->ld_obd, index, 0, 0); + lov_del_target(d->ld_obd, index, NULL, 0); break; case LCFG_LOV_DEL_OBD: lov_cl_del_target(env, d, index); diff --git a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c index e6af825eabcb..d1d891b91663 100644 --- a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c +++ b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c @@ -172,39 +172,39 @@ LPROC_SEQ_FOPS_RW_TYPE(mdc, import); LPROC_SEQ_FOPS_RW_TYPE(mdc, pinger_recov); static struct lprocfs_vars lprocfs_mdc_obd_vars[] = { - { "uuid", &mdc_uuid_fops, 0, 0 }, - { "ping", &mdc_ping_fops, 0, 0222 }, - { "connect_flags", &mdc_connect_flags_fops, 0, 0 }, - { "blocksize", &mdc_blksize_fops, 0, 0 }, - { "kbytestotal", &mdc_kbytestotal_fops, 0, 0 }, - { "kbytesfree", &mdc_kbytesfree_fops, 0, 0 }, - { "kbytesavail", &mdc_kbytesavail_fops, 0, 0 }, - { "filestotal", &mdc_filestotal_fops, 0, 0 }, - { "filesfree", &mdc_filesfree_fops, 0, 0 }, - /*{ "filegroups", lprocfs_rd_filegroups, 0, 0 },*/ - { "mds_server_uuid", &mdc_server_uuid_fops, 0, 0 }, - { "mds_conn_uuid", &mdc_conn_uuid_fops, 0, 0 }, + { "uuid", &mdc_uuid_fops, NULL, 0 }, + { "ping", &mdc_ping_fops, NULL, 0222 }, + { "connect_flags", &mdc_connect_flags_fops, NULL, 0 }, + { "blocksize", &mdc_blksize_fops, NULL, 0 }, + { "kbytestotal", &mdc_kbytestotal_fops, NULL, 0 }, + { "kbytesfree", &mdc_kbytesfree_fops, NULL, 0 }, + { "kbytesavail", &mdc_kbytesavail_fops, NULL, 0 }, + { "filestotal", &mdc_filestotal_fops, NULL, 0 }, + { "filesfree", &mdc_filesfree_fops, NULL, 0 }, + /*{ "filegroups", lprocfs_rd_filegroups, NULL, 0 },*/ + { "mds_server_uuid", &mdc_server_uuid_fops, NULL, 0 }, + { "mds_conn_uuid", &mdc_conn_uuid_fops, NULL, 0 }, /* * FIXME: below proc entry is provided, but not in used, instead * sbi->sb_md_brw_size is used, the per obd variable should be used * when CMD is enabled, and dir pages are managed in MDC layer. * Remember to enable proc write function. */ - { "max_pages_per_rpc", &mdc_obd_max_pages_per_rpc_fops, 0, 0 }, - { "max_rpcs_in_flight", &mdc_max_rpcs_in_flight_fops, 0, 0 }, - { "timeouts", &mdc_timeouts_fops, 0, 0 }, - { "import", &mdc_import_fops, 0 }, - { "state", &mdc_state_fops, 0, 0 }, - { "hsm_nl", &mdc_kuc_fops, 0, 0200 }, - { "pinger_recov", &mdc_pinger_recov_fops, 0, 0 }, - { 0 } + { "max_pages_per_rpc", &mdc_obd_max_pages_per_rpc_fops, NULL, 0 }, + { "max_rpcs_in_flight", &mdc_max_rpcs_in_flight_fops, NULL, 0 }, + { "timeouts", &mdc_timeouts_fops, NULL, 0 }, + { "import", &mdc_import_fops, NULL, 0 }, + { "state", &mdc_state_fops, NULL, 0 }, + { "hsm_nl", &mdc_kuc_fops, NULL, 0200 }, + { "pinger_recov", &mdc_pinger_recov_fops, NULL, 0 }, + { NULL } }; LPROC_SEQ_FOPS_RO_TYPE(mdc, numrefs); static struct lprocfs_vars lprocfs_mdc_module_vars[] = { - { "num_refs", &mdc_numrefs_fops, 0, 0 }, - { 0 } + { "num_refs", &mdc_numrefs_fops, NULL, 0 }, + { NULL } }; void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 185fe66c18a3..4a1cc4eb73d5 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2423,7 +2423,7 @@ struct ldlm_valblock_ops inode_lvbo = { static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg) { struct client_obd *cli = &obd->u.cli; - struct lprocfs_static_vars lvars = { 0 }; + struct lprocfs_static_vars lvars = { NULL }; int rc; OBD_ALLOC(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock)); @@ -2566,7 +2566,7 @@ static int mdc_llog_finish(struct obd_device *obd, int count) static int mdc_process_config(struct obd_device *obd, obd_count len, void *buf) { struct lustre_cfg *lcfg = buf; - struct lprocfs_static_vars lvars = { 0 }; + struct lprocfs_static_vars lvars = { NULL }; int rc = 0; lprocfs_mdc_init_vars(&lvars); @@ -2737,7 +2737,7 @@ struct md_ops mdc_md_ops = { int __init mdc_init(void) { int rc; - struct lprocfs_static_vars lvars = { 0 }; + struct lprocfs_static_vars lvars = { NULL }; lprocfs_mdc_init_vars(&lvars); rc = class_register_type(&mdc_obd_ops, &mdc_md_ops, lvars.module_vars, diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 46a7d767e828..f520591d5784 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -197,7 +197,7 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd, int rc; CDEBUG(D_MGC, "do adding config log %s:%p\n", logname, - cfg ? cfg->cfg_instance : 0); + cfg ? cfg->cfg_instance : NULL); OBD_ALLOC(cld, sizeof(*cld) + strlen(logname) + 1); if (!cld) diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c index 1de1c650cf22..9ce3d36c685d 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c @@ -328,7 +328,7 @@ struct lprocfs_vars lprocfs_base[] = { { "jobid_var", &obd_proc_jobid_var_fops }, { .name = "jobid_name", .fops = &obd_proc_jobid_name_fops}, - { 0 } + { NULL } }; static void *obd_device_list_seq_start(struct seq_file *p, loff_t *pos) diff --git a/drivers/staging/lustre/lustre/obdclass/llog_test.c b/drivers/staging/lustre/lustre/obdclass/llog_test.c index 6791d0263b11..ef008abd331c 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_test.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_test.c @@ -940,8 +940,8 @@ cleanup_ctxt: } #if defined (CONFIG_PROC_FS) -static struct lprocfs_vars lprocfs_llog_test_obd_vars[] = { {0} }; -static struct lprocfs_vars lprocfs_llog_test_module_vars[] = { {0} }; +static struct lprocfs_vars lprocfs_llog_test_obd_vars[] = { { NULL } }; +static struct lprocfs_vars lprocfs_llog_test_module_vars[] = { { NULL } }; static void lprocfs_llog_test_init_vars(struct lprocfs_static_vars *lvars) { lvars->module_vars = lprocfs_llog_test_module_vars; diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 3acb1a86cfc7..0d81d3232f31 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -1161,7 +1161,7 @@ int class_process_config(struct lustre_cfg *lcfg) char *tmp; /* llite has no obd */ if ((class_match_param(lustre_cfg_string(lcfg, 1), - PARAM_LLITE, 0) == 0) && + PARAM_LLITE, NULL) == 0) && client_process_config) { err = (*client_process_config)(lcfg); GOTO(out, err); @@ -1303,8 +1303,8 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, /* Search proc entries */ while (lvars[j].name) { var = &lvars[j]; - if (class_match_param(key, (char *)var->name, 0) == 0 && - keylen == strlen(var->name)) { + if (class_match_param(key, (char *)var->name, NULL) == 0 + && keylen == strlen(var->name)) { matched++; rc = -EROFS; if (var->fops && var->fops->write) { diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index b3428d972545..f1847f3f579d 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -3113,7 +3113,7 @@ static struct obd_ops echo_client_obd_ops = { int echo_client_init(void) { - struct lprocfs_static_vars lvars = { 0 }; + struct lprocfs_static_vars lvars = { NULL }; int rc; lprocfs_echo_init_vars(&lvars); diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 5028e77bf8bf..fb0d9fb9cebc 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -3421,7 +3421,7 @@ static int brw_queue_work(const struct lu_env *env, void *data) int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) { - struct lprocfs_static_vars lvars = { 0 }; + struct lprocfs_static_vars lvars = { NULL }; struct client_obd *cli = &obd->u.cli; void *handler; int rc; @@ -3545,7 +3545,7 @@ int osc_cleanup(struct obd_device *obd) int osc_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg) { - struct lprocfs_static_vars lvars = { 0 }; + struct lprocfs_static_vars lvars = { NULL }; int rc = 0; lprocfs_osc_init_vars(&lvars); @@ -3612,7 +3612,7 @@ extern struct lock_class_key osc_ast_guard_class; int __init osc_init(void) { - struct lprocfs_static_vars lvars = { 0 }; + struct lprocfs_static_vars lvars = { NULL }; int rc; /* print an address of _any_ initialized kernel symbol from this -- 2.20.1