Commit 15d9f520 authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman

staging/lustre/libcfs: Adjust NULL comparison codestyle

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"
Also removed some redundant assertions.
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 01866032
...@@ -378,7 +378,7 @@ libcfs_debug_mask2str(char *str, int size, int mask, int is_subsys) ...@@ -378,7 +378,7 @@ libcfs_debug_mask2str(char *str, int size, int mask, int is_subsys)
continue; continue;
token = fn(i); token = fn(i);
if (token == NULL) /* unused bit */ if (!token) /* unused bit */
continue; continue;
if (len > 0) { /* separator? */ if (len > 0) { /* separator? */
...@@ -505,7 +505,7 @@ int libcfs_debug_init(unsigned long bufsize) ...@@ -505,7 +505,7 @@ int libcfs_debug_init(unsigned long bufsize)
libcfs_console_min_delay = CDEBUG_DEFAULT_MIN_DELAY; libcfs_console_min_delay = CDEBUG_DEFAULT_MIN_DELAY;
} }
if (libcfs_debug_file_path != NULL) { if (libcfs_debug_file_path) {
strlcpy(libcfs_debug_file_path_arr, strlcpy(libcfs_debug_file_path_arr,
libcfs_debug_file_path, libcfs_debug_file_path,
sizeof(libcfs_debug_file_path_arr)); sizeof(libcfs_debug_file_path_arr));
......
This diff is collapsed.
...@@ -56,7 +56,7 @@ cfs_cpt_table_alloc(unsigned int ncpt) ...@@ -56,7 +56,7 @@ cfs_cpt_table_alloc(unsigned int ncpt)
} }
LIBCFS_ALLOC(cptab, sizeof(*cptab)); LIBCFS_ALLOC(cptab, sizeof(*cptab));
if (cptab != NULL) { if (cptab) {
cptab->ctb_version = CFS_CPU_VERSION_MAGIC; cptab->ctb_version = CFS_CPU_VERSION_MAGIC;
node_set(0, cptab->ctb_nodemask); node_set(0, cptab->ctb_nodemask);
cptab->ctb_nparts = ncpt; cptab->ctb_nparts = ncpt;
...@@ -215,7 +215,7 @@ EXPORT_SYMBOL(cfs_cpt_bind); ...@@ -215,7 +215,7 @@ EXPORT_SYMBOL(cfs_cpt_bind);
void void
cfs_cpu_fini(void) cfs_cpu_fini(void)
{ {
if (cfs_cpt_table != NULL) { if (cfs_cpt_table) {
cfs_cpt_table_free(cfs_cpt_table); cfs_cpt_table_free(cfs_cpt_table);
cfs_cpt_table = NULL; cfs_cpt_table = NULL;
} }
...@@ -226,7 +226,7 @@ cfs_cpu_init(void) ...@@ -226,7 +226,7 @@ cfs_cpu_init(void)
{ {
cfs_cpt_table = cfs_cpt_table_alloc(1); cfs_cpt_table = cfs_cpt_table_alloc(1);
return cfs_cpt_table != NULL ? 0 : -1; return cfs_cpt_table ? 0 : -1;
} }
#endif /* HAVE_LIBCFS_CPT */ #endif /* HAVE_LIBCFS_CPT */
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
void void
cfs_percpt_lock_free(struct cfs_percpt_lock *pcl) cfs_percpt_lock_free(struct cfs_percpt_lock *pcl)
{ {
LASSERT(pcl->pcl_locks != NULL); LASSERT(pcl->pcl_locks);
LASSERT(!pcl->pcl_locked); LASSERT(!pcl->pcl_locked);
cfs_percpt_free(pcl->pcl_locks); cfs_percpt_free(pcl->pcl_locks);
......
...@@ -54,7 +54,7 @@ cfs_percpt_free(void *vars) ...@@ -54,7 +54,7 @@ cfs_percpt_free(void *vars)
arr = container_of(vars, struct cfs_var_array, va_ptrs[0]); arr = container_of(vars, struct cfs_var_array, va_ptrs[0]);
for (i = 0; i < arr->va_count; i++) { for (i = 0; i < arr->va_count; i++) {
if (arr->va_ptrs[i] != NULL) if (arr->va_ptrs[i])
LIBCFS_FREE(arr->va_ptrs[i], arr->va_size); LIBCFS_FREE(arr->va_ptrs[i], arr->va_size);
} }
......
...@@ -81,8 +81,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), ...@@ -81,8 +81,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
found = 0; found = 0;
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
debugstr = bit2str(i); debugstr = bit2str(i);
if (debugstr != NULL && if (debugstr && strlen(debugstr) == len &&
strlen(debugstr) == len &&
strncasecmp(str, debugstr, len) == 0) { strncasecmp(str, debugstr, len) == 0) {
if (op == '-') if (op == '-')
newmask &= ~(1 << i); newmask &= ~(1 << i);
...@@ -175,7 +174,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res) ...@@ -175,7 +174,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res)
{ {
char *end; char *end;
if (next->ls_str == NULL) if (!next->ls_str)
return 0; return 0;
/* skip leading white spaces */ /* skip leading white spaces */
...@@ -196,7 +195,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res) ...@@ -196,7 +195,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res)
res->ls_str = next->ls_str; res->ls_str = next->ls_str;
end = memchr(next->ls_str, delim, next->ls_len); end = memchr(next->ls_str, delim, next->ls_len);
if (end == NULL) { if (!end) {
/* there is no the delimeter in the string */ /* there is no the delimeter in the string */
end = next->ls_str + next->ls_len; end = next->ls_str + next->ls_len;
next->ls_str = NULL; next->ls_str = NULL;
...@@ -266,7 +265,7 @@ cfs_range_expr_parse(struct cfs_lstr *src, unsigned min, unsigned max, ...@@ -266,7 +265,7 @@ cfs_range_expr_parse(struct cfs_lstr *src, unsigned min, unsigned max,
struct cfs_lstr tok; struct cfs_lstr tok;
LIBCFS_ALLOC(re, sizeof(*re)); LIBCFS_ALLOC(re, sizeof(*re));
if (re == NULL) if (!re)
return -ENOMEM; return -ENOMEM;
if (src->ls_len == 1 && src->ls_str[0] == '*') { if (src->ls_len == 1 && src->ls_str[0] == '*') {
...@@ -442,7 +441,7 @@ cfs_expr_list_values(struct cfs_expr_list *expr_list, int max, __u32 **valpp) ...@@ -442,7 +441,7 @@ cfs_expr_list_values(struct cfs_expr_list *expr_list, int max, __u32 **valpp)
} }
LIBCFS_ALLOC(val, sizeof(val[0]) * count); LIBCFS_ALLOC(val, sizeof(val[0]) * count);
if (val == NULL) if (!val)
return -ENOMEM; return -ENOMEM;
count = 0; count = 0;
...@@ -495,7 +494,7 @@ cfs_expr_list_parse(char *str, int len, unsigned min, unsigned max, ...@@ -495,7 +494,7 @@ cfs_expr_list_parse(char *str, int len, unsigned min, unsigned max,
int rc; int rc;
LIBCFS_ALLOC(expr_list, sizeof(*expr_list)); LIBCFS_ALLOC(expr_list, sizeof(*expr_list));
if (expr_list == NULL) if (!expr_list)
return -ENOMEM; return -ENOMEM;
src.ls_str = str; src.ls_str = str;
...@@ -509,7 +508,7 @@ cfs_expr_list_parse(char *str, int len, unsigned min, unsigned max, ...@@ -509,7 +508,7 @@ cfs_expr_list_parse(char *str, int len, unsigned min, unsigned max,
src.ls_len -= 2; src.ls_len -= 2;
rc = -EINVAL; rc = -EINVAL;
while (src.ls_str != NULL) { while (src.ls_str) {
struct cfs_lstr tok; struct cfs_lstr tok;
if (!cfs_gettok(&src, ',', &tok)) { if (!cfs_gettok(&src, ',', &tok)) {
......
...@@ -84,32 +84,32 @@ cfs_cpt_table_free(struct cfs_cpt_table *cptab) ...@@ -84,32 +84,32 @@ cfs_cpt_table_free(struct cfs_cpt_table *cptab)
{ {
int i; int i;
if (cptab->ctb_cpu2cpt != NULL) { if (cptab->ctb_cpu2cpt) {
LIBCFS_FREE(cptab->ctb_cpu2cpt, LIBCFS_FREE(cptab->ctb_cpu2cpt,
num_possible_cpus() * num_possible_cpus() *
sizeof(cptab->ctb_cpu2cpt[0])); sizeof(cptab->ctb_cpu2cpt[0]));
} }
for (i = 0; cptab->ctb_parts != NULL && i < cptab->ctb_nparts; i++) { for (i = 0; cptab->ctb_parts && i < cptab->ctb_nparts; i++) {
struct cfs_cpu_partition *part = &cptab->ctb_parts[i]; struct cfs_cpu_partition *part = &cptab->ctb_parts[i];
if (part->cpt_nodemask != NULL) { if (part->cpt_nodemask) {
LIBCFS_FREE(part->cpt_nodemask, LIBCFS_FREE(part->cpt_nodemask,
sizeof(*part->cpt_nodemask)); sizeof(*part->cpt_nodemask));
} }
if (part->cpt_cpumask != NULL) if (part->cpt_cpumask)
LIBCFS_FREE(part->cpt_cpumask, cpumask_size()); LIBCFS_FREE(part->cpt_cpumask, cpumask_size());
} }
if (cptab->ctb_parts != NULL) { if (cptab->ctb_parts) {
LIBCFS_FREE(cptab->ctb_parts, LIBCFS_FREE(cptab->ctb_parts,
cptab->ctb_nparts * sizeof(cptab->ctb_parts[0])); cptab->ctb_nparts * sizeof(cptab->ctb_parts[0]));
} }
if (cptab->ctb_nodemask != NULL) if (cptab->ctb_nodemask)
LIBCFS_FREE(cptab->ctb_nodemask, sizeof(*cptab->ctb_nodemask)); LIBCFS_FREE(cptab->ctb_nodemask, sizeof(*cptab->ctb_nodemask));
if (cptab->ctb_cpumask != NULL) if (cptab->ctb_cpumask)
LIBCFS_FREE(cptab->ctb_cpumask, cpumask_size()); LIBCFS_FREE(cptab->ctb_cpumask, cpumask_size());
LIBCFS_FREE(cptab, sizeof(*cptab)); LIBCFS_FREE(cptab, sizeof(*cptab));
...@@ -123,7 +123,7 @@ cfs_cpt_table_alloc(unsigned int ncpt) ...@@ -123,7 +123,7 @@ cfs_cpt_table_alloc(unsigned int ncpt)
int i; int i;
LIBCFS_ALLOC(cptab, sizeof(*cptab)); LIBCFS_ALLOC(cptab, sizeof(*cptab));
if (cptab == NULL) if (!cptab)
return NULL; return NULL;
cptab->ctb_nparts = ncpt; cptab->ctb_nparts = ncpt;
...@@ -131,19 +131,19 @@ cfs_cpt_table_alloc(unsigned int ncpt) ...@@ -131,19 +131,19 @@ cfs_cpt_table_alloc(unsigned int ncpt)
LIBCFS_ALLOC(cptab->ctb_cpumask, cpumask_size()); LIBCFS_ALLOC(cptab->ctb_cpumask, cpumask_size());
LIBCFS_ALLOC(cptab->ctb_nodemask, sizeof(*cptab->ctb_nodemask)); LIBCFS_ALLOC(cptab->ctb_nodemask, sizeof(*cptab->ctb_nodemask));
if (cptab->ctb_cpumask == NULL || cptab->ctb_nodemask == NULL) if (!cptab->ctb_cpumask || !cptab->ctb_nodemask)
goto failed; goto failed;
LIBCFS_ALLOC(cptab->ctb_cpu2cpt, LIBCFS_ALLOC(cptab->ctb_cpu2cpt,
num_possible_cpus() * sizeof(cptab->ctb_cpu2cpt[0])); num_possible_cpus() * sizeof(cptab->ctb_cpu2cpt[0]));
if (cptab->ctb_cpu2cpt == NULL) if (!cptab->ctb_cpu2cpt)
goto failed; goto failed;
memset(cptab->ctb_cpu2cpt, -1, memset(cptab->ctb_cpu2cpt, -1,
num_possible_cpus() * sizeof(cptab->ctb_cpu2cpt[0])); num_possible_cpus() * sizeof(cptab->ctb_cpu2cpt[0]));
LIBCFS_ALLOC(cptab->ctb_parts, ncpt * sizeof(cptab->ctb_parts[0])); LIBCFS_ALLOC(cptab->ctb_parts, ncpt * sizeof(cptab->ctb_parts[0]));
if (cptab->ctb_parts == NULL) if (!cptab->ctb_parts)
goto failed; goto failed;
for (i = 0; i < ncpt; i++) { for (i = 0; i < ncpt; i++) {
...@@ -151,7 +151,7 @@ cfs_cpt_table_alloc(unsigned int ncpt) ...@@ -151,7 +151,7 @@ cfs_cpt_table_alloc(unsigned int ncpt)
LIBCFS_ALLOC(part->cpt_cpumask, cpumask_size()); LIBCFS_ALLOC(part->cpt_cpumask, cpumask_size());
LIBCFS_ALLOC(part->cpt_nodemask, sizeof(*part->cpt_nodemask)); LIBCFS_ALLOC(part->cpt_nodemask, sizeof(*part->cpt_nodemask));
if (part->cpt_cpumask == NULL || part->cpt_nodemask == NULL) if (!part->cpt_cpumask || !part->cpt_nodemask)
goto failed; goto failed;
} }
...@@ -618,7 +618,7 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt, ...@@ -618,7 +618,7 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt,
/* allocate scratch buffer */ /* allocate scratch buffer */
LIBCFS_ALLOC(socket, cpumask_size()); LIBCFS_ALLOC(socket, cpumask_size());
LIBCFS_ALLOC(core, cpumask_size()); LIBCFS_ALLOC(core, cpumask_size());
if (socket == NULL || core == NULL) { if (!socket || !core) {
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
} }
...@@ -659,9 +659,9 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt, ...@@ -659,9 +659,9 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt,
} }
out: out:
if (socket != NULL) if (socket)
LIBCFS_FREE(socket, cpumask_size()); LIBCFS_FREE(socket, cpumask_size());
if (core != NULL) if (core)
LIBCFS_FREE(core, cpumask_size()); LIBCFS_FREE(core, cpumask_size());
return rc; return rc;
} }
...@@ -735,7 +735,7 @@ cfs_cpt_table_create(int ncpt) ...@@ -735,7 +735,7 @@ cfs_cpt_table_create(int ncpt)
} }
cptab = cfs_cpt_table_alloc(ncpt); cptab = cfs_cpt_table_alloc(ncpt);
if (cptab == NULL) { if (!cptab) {
CERROR("Failed to allocate CPU map(%d)\n", ncpt); CERROR("Failed to allocate CPU map(%d)\n", ncpt);
goto failed; goto failed;
} }
...@@ -747,7 +747,7 @@ cfs_cpt_table_create(int ncpt) ...@@ -747,7 +747,7 @@ cfs_cpt_table_create(int ncpt)
} }
LIBCFS_ALLOC(mask, cpumask_size()); LIBCFS_ALLOC(mask, cpumask_size());
if (mask == NULL) { if (!mask) {
CERROR("Failed to allocate scratch cpumask\n"); CERROR("Failed to allocate scratch cpumask\n");
goto failed; goto failed;
} }
...@@ -793,10 +793,10 @@ cfs_cpt_table_create(int ncpt) ...@@ -793,10 +793,10 @@ cfs_cpt_table_create(int ncpt)
CERROR("Failed to setup CPU-partition-table with %d CPU-partitions, online HW nodes: %d, HW cpus: %d.\n", CERROR("Failed to setup CPU-partition-table with %d CPU-partitions, online HW nodes: %d, HW cpus: %d.\n",
ncpt, num_online_nodes(), num_online_cpus()); ncpt, num_online_nodes(), num_online_cpus());
if (mask != NULL) if (mask)
LIBCFS_FREE(mask, cpumask_size()); LIBCFS_FREE(mask, cpumask_size());
if (cptab != NULL) if (cptab)
cfs_cpt_table_free(cptab); cfs_cpt_table_free(cptab);
return NULL; return NULL;
...@@ -814,7 +814,7 @@ cfs_cpt_table_create_pattern(char *pattern) ...@@ -814,7 +814,7 @@ cfs_cpt_table_create_pattern(char *pattern)
for (ncpt = 0;; ncpt++) { /* quick scan bracket */ for (ncpt = 0;; ncpt++) { /* quick scan bracket */
str = strchr(str, '['); str = strchr(str, '[');
if (str == NULL) if (!str)
break; break;
str++; str++;
} }
...@@ -836,7 +836,7 @@ cfs_cpt_table_create_pattern(char *pattern) ...@@ -836,7 +836,7 @@ cfs_cpt_table_create_pattern(char *pattern)
high = node ? MAX_NUMNODES - 1 : nr_cpu_ids - 1; high = node ? MAX_NUMNODES - 1 : nr_cpu_ids - 1;
cptab = cfs_cpt_table_alloc(ncpt); cptab = cfs_cpt_table_alloc(ncpt);
if (cptab == NULL) { if (!cptab) {
CERROR("Failed to allocate cpu partition table\n"); CERROR("Failed to allocate cpu partition table\n");
return NULL; return NULL;
} }
...@@ -850,7 +850,7 @@ cfs_cpt_table_create_pattern(char *pattern) ...@@ -850,7 +850,7 @@ cfs_cpt_table_create_pattern(char *pattern)
int i; int i;
int n; int n;
if (bracket == NULL) { if (!bracket) {
if (*str != 0) { if (*str != 0) {
CERROR("Invalid pattern %s\n", str); CERROR("Invalid pattern %s\n", str);
goto failed; goto failed;
...@@ -885,7 +885,7 @@ cfs_cpt_table_create_pattern(char *pattern) ...@@ -885,7 +885,7 @@ cfs_cpt_table_create_pattern(char *pattern)
} }
bracket = strchr(str, ']'); bracket = strchr(str, ']');
if (bracket == NULL) { if (!bracket) {
CERROR("missing right bracket for cpt %d, %s\n", CERROR("missing right bracket for cpt %d, %s\n",
cpt, str); cpt, str);
goto failed; goto failed;
...@@ -975,25 +975,25 @@ static struct notifier_block cfs_cpu_notifier = { ...@@ -975,25 +975,25 @@ static struct notifier_block cfs_cpu_notifier = {
void void
cfs_cpu_fini(void) cfs_cpu_fini(void)
{ {
if (cfs_cpt_table != NULL) if (cfs_cpt_table)
cfs_cpt_table_free(cfs_cpt_table); cfs_cpt_table_free(cfs_cpt_table);
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
unregister_hotcpu_notifier(&cfs_cpu_notifier); unregister_hotcpu_notifier(&cfs_cpu_notifier);
#endif #endif
if (cpt_data.cpt_cpumask != NULL) if (cpt_data.cpt_cpumask)
LIBCFS_FREE(cpt_data.cpt_cpumask, cpumask_size()); LIBCFS_FREE(cpt_data.cpt_cpumask, cpumask_size());
} }
int int
cfs_cpu_init(void) cfs_cpu_init(void)
{ {
LASSERT(cfs_cpt_table == NULL); LASSERT(!cfs_cpt_table);
memset(&cpt_data, 0, sizeof(cpt_data)); memset(&cpt_data, 0, sizeof(cpt_data));
LIBCFS_ALLOC(cpt_data.cpt_cpumask, cpumask_size()); LIBCFS_ALLOC(cpt_data.cpt_cpumask, cpumask_size());
if (cpt_data.cpt_cpumask == NULL) { if (!cpt_data.cpt_cpumask) {
CERROR("Failed to allocate scratch buffer\n"); CERROR("Failed to allocate scratch buffer\n");
return -1; return -1;
} }
...@@ -1007,7 +1007,7 @@ cfs_cpu_init(void) ...@@ -1007,7 +1007,7 @@ cfs_cpu_init(void)
if (*cpu_pattern != 0) { if (*cpu_pattern != 0) {
cfs_cpt_table = cfs_cpt_table_create_pattern(cpu_pattern); cfs_cpt_table = cfs_cpt_table_create_pattern(cpu_pattern);
if (cfs_cpt_table == NULL) { if (!cfs_cpt_table) {
CERROR("Failed to create cptab from pattern %s\n", CERROR("Failed to create cptab from pattern %s\n",
cpu_pattern); cpu_pattern);
goto failed; goto failed;
...@@ -1015,7 +1015,7 @@ cfs_cpu_init(void) ...@@ -1015,7 +1015,7 @@ cfs_cpu_init(void)
} else { } else {
cfs_cpt_table = cfs_cpt_table_create(cpu_npartitions); cfs_cpt_table = cfs_cpt_table_create(cpu_npartitions);
if (cfs_cpt_table == NULL) { if (!cfs_cpt_table) {
CERROR("Failed to create ptable with npartitions %d\n", CERROR("Failed to create ptable with npartitions %d\n",
cpu_npartitions); cpu_npartitions);
goto failed; goto failed;
......
...@@ -45,14 +45,14 @@ static int cfs_crypto_hash_alloc(unsigned char alg_id, ...@@ -45,14 +45,14 @@ static int cfs_crypto_hash_alloc(unsigned char alg_id,
*type = cfs_crypto_hash_type(alg_id); *type = cfs_crypto_hash_type(alg_id);
if (*type == NULL) { if (!*type) {
CWARN("Unsupported hash algorithm id = %d, max id is %d\n", CWARN("Unsupported hash algorithm id = %d, max id is %d\n",
alg_id, CFS_HASH_ALG_MAX); alg_id, CFS_HASH_ALG_MAX);
return -EINVAL; return -EINVAL;
} }
desc->tfm = crypto_alloc_hash((*type)->cht_name, 0, 0); desc->tfm = crypto_alloc_hash((*type)->cht_name, 0, 0);
if (desc->tfm == NULL) if (!desc->tfm)
return -EINVAL; return -EINVAL;
if (IS_ERR(desc->tfm)) { if (IS_ERR(desc->tfm)) {
...@@ -69,7 +69,7 @@ static int cfs_crypto_hash_alloc(unsigned char alg_id, ...@@ -69,7 +69,7 @@ static int cfs_crypto_hash_alloc(unsigned char alg_id,
* Skip this function for digest, because we use shash logic at * Skip this function for digest, because we use shash logic at
* cfs_crypto_hash_alloc. * cfs_crypto_hash_alloc.
*/ */
if (key != NULL) if (key)
err = crypto_hash_setkey(desc->tfm, key, key_len); err = crypto_hash_setkey(desc->tfm, key, key_len);
else if ((*type)->cht_key != 0) else if ((*type)->cht_key != 0)
err = crypto_hash_setkey(desc->tfm, err = crypto_hash_setkey(desc->tfm,
...@@ -99,14 +99,14 @@ int cfs_crypto_hash_digest(unsigned char alg_id, ...@@ -99,14 +99,14 @@ int cfs_crypto_hash_digest(unsigned char alg_id,
int err; int err;
const struct cfs_crypto_hash_type *type; const struct cfs_crypto_hash_type *type;
if (buf == NULL || buf_len == 0 || hash_len == NULL) if (!buf || buf_len == 0 || !hash_len)
return -EINVAL; return -EINVAL;
err = cfs_crypto_hash_alloc(alg_id, &type, &hdesc, key, key_len); err = cfs_crypto_hash_alloc(alg_id, &type, &hdesc, key, key_len);
if (err != 0) if (err != 0)
return err; return err;
if (hash == NULL || *hash_len < type->cht_size) { if (!hash || *hash_len < type->cht_size) {
*hash_len = type->cht_size; *hash_len = type->cht_size;
crypto_free_hash(hdesc.tfm); crypto_free_hash(hdesc.tfm);
return -ENOSPC; return -ENOSPC;
...@@ -131,7 +131,7 @@ struct cfs_crypto_hash_desc * ...@@ -131,7 +131,7 @@ struct cfs_crypto_hash_desc *
const struct cfs_crypto_hash_type *type; const struct cfs_crypto_hash_type *type;
hdesc = kmalloc(sizeof(*hdesc), 0); hdesc = kmalloc(sizeof(*hdesc), 0);
if (hdesc == NULL) if (!hdesc)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
err = cfs_crypto_hash_alloc(alg_id, &type, hdesc, key, key_len); err = cfs_crypto_hash_alloc(alg_id, &type, hdesc, key, key_len);
...@@ -175,12 +175,12 @@ int cfs_crypto_hash_final(struct cfs_crypto_hash_desc *hdesc, ...@@ -175,12 +175,12 @@ int cfs_crypto_hash_final(struct cfs_crypto_hash_desc *hdesc,
int err; int err;
int size = crypto_hash_digestsize(((struct hash_desc *)hdesc)->tfm); int size = crypto_hash_digestsize(((struct hash_desc *)hdesc)->tfm);
if (hash_len == NULL) { if (!hash_len) {
crypto_free_hash(((struct hash_desc *)hdesc)->tfm); crypto_free_hash(((struct hash_desc *)hdesc)->tfm);
kfree(hdesc); kfree(hdesc);
return 0; return 0;
} }
if (hash == NULL || *hash_len < size) { if (!hash || *hash_len < size) {
*hash_len = size; *hash_len = size;
return -ENOSPC; return -ENOSPC;
} }
...@@ -253,7 +253,7 @@ static int cfs_crypto_test_hashes(void) ...@@ -253,7 +253,7 @@ static int cfs_crypto_test_hashes(void)
unsigned int data_len = 1 * 128 * 1024; unsigned int data_len = 1 * 128 * 1024;
data = kmalloc(data_len, 0); data = kmalloc(data_len, 0);
if (data == NULL) { if (!data) {
CERROR("Failed to allocate mem\n"); CERROR("Failed to allocate mem\n");
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -80,7 +80,7 @@ void libcfs_run_debug_log_upcall(char *file) ...@@ -80,7 +80,7 @@ void libcfs_run_debug_log_upcall(char *file)
argv[0] = lnet_debug_log_upcall; argv[0] = lnet_debug_log_upcall;
LASSERTF(file != NULL, "called on a null filename\n"); LASSERTF(file, "called on a null filename\n");
argv[1] = file; /* only need to pass the path of the file */ argv[1] = file; /* only need to pass the path of the file */
argv[2] = NULL; argv[2] = NULL;
...@@ -106,7 +106,7 @@ void libcfs_run_upcall(char **argv) ...@@ -106,7 +106,7 @@ void libcfs_run_upcall(char **argv)
argv[0] = lnet_upcall; argv[0] = lnet_upcall;
argc = 1; argc = 1;
while (argv[argc] != NULL) while (argv[argc])
argc++; argc++;
LASSERT(argc >= 2); LASSERT(argc >= 2);
......
...@@ -102,7 +102,7 @@ libcfs_psdev_open(struct inode *inode, struct file *file) ...@@ -102,7 +102,7 @@ libcfs_psdev_open(struct inode *inode, struct file *file)
if (!inode) if (!inode)
return -EINVAL; return -EINVAL;
if (libcfs_psdev_ops.p_open != NULL) if (libcfs_psdev_ops.p_open)
rc = libcfs_psdev_ops.p_open(0, NULL); rc = libcfs_psdev_ops.p_open(0, NULL);
else else
return -EPERM; return -EPERM;
...@@ -117,7 +117,7 @@ libcfs_psdev_release(struct inode *inode, struct file *file) ...@@ -117,7 +117,7 @@ libcfs_psdev_release(struct inode *inode, struct file *file)
if (!inode) if (!inode)
return -EINVAL; return -EINVAL;
if (libcfs_psdev_ops.p_close != NULL) if (libcfs_psdev_ops.p_close)
rc = libcfs_psdev_ops.p_close(0, NULL); rc = libcfs_psdev_ops.p_close(0, NULL);
else else
rc = -EPERM; rc = -EPERM;
...@@ -150,7 +150,7 @@ static long libcfs_ioctl(struct file *file, ...@@ -150,7 +150,7 @@ static long libcfs_ioctl(struct file *file,
return 0; return 0;
} }
if (libcfs_psdev_ops.p_ioctl != NULL) if (libcfs_psdev_ops.p_ioctl)
rc = libcfs_psdev_ops.p_ioctl(&pfile, cmd, (void __user *)arg); rc = libcfs_psdev_ops.p_ioctl(&pfile, cmd, (void __user *)arg);
else else
rc = -EPERM; rc = -EPERM;
......
...@@ -63,7 +63,7 @@ int cfs_tracefile_init_arch(void) ...@@ -63,7 +63,7 @@ int cfs_tracefile_init_arch(void)
cfs_trace_data[i] = cfs_trace_data[i] =
kmalloc(sizeof(union cfs_trace_data_union) * kmalloc(sizeof(union cfs_trace_data_union) *
num_possible_cpus(), GFP_KERNEL); num_possible_cpus(), GFP_KERNEL);
if (cfs_trace_data[i] == NULL) if (!cfs_trace_data[i])
goto out; goto out;
} }
...@@ -82,7 +82,7 @@ int cfs_tracefile_init_arch(void) ...@@ -82,7 +82,7 @@ int cfs_tracefile_init_arch(void)
kmalloc(CFS_TRACE_CONSOLE_BUFFER_SIZE, kmalloc(CFS_TRACE_CONSOLE_BUFFER_SIZE,
GFP_KERNEL); GFP_KERNEL);
if (cfs_trace_console_buffers[i][j] == NULL) if (!cfs_trace_console_buffers[i][j])
goto out; goto out;
} }
...@@ -105,7 +105,7 @@ void cfs_tracefile_fini_arch(void) ...@@ -105,7 +105,7 @@ void cfs_tracefile_fini_arch(void)
cfs_trace_console_buffers[i][j] = NULL; cfs_trace_console_buffers[i][j] = NULL;
} }
for (i = 0; cfs_trace_data[i] != NULL; i++) { for (i = 0; cfs_trace_data[i]; i++) {
kfree(cfs_trace_data[i]); kfree(cfs_trace_data[i]);
cfs_trace_data[i] = NULL; cfs_trace_data[i] = NULL;
} }
......
...@@ -129,7 +129,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd, ...@@ -129,7 +129,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
* Handled in arch/cfs_module.c * Handled in arch/cfs_module.c
*/ */
case IOC_LIBCFS_MARK_DEBUG: case IOC_LIBCFS_MARK_DEBUG:
if (data->ioc_inlbuf1 == NULL || if (!data->ioc_inlbuf1 ||
data->ioc_inlbuf1[data->ioc_inllen1 - 1] != '\0') data->ioc_inlbuf1[data->ioc_inllen1 - 1] != '\0')
return -EINVAL; return -EINVAL;
libcfs_debug_mark_buffer(data->ioc_inlbuf1); libcfs_debug_mark_buffer(data->ioc_inlbuf1);
...@@ -165,7 +165,7 @@ static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, ...@@ -165,7 +165,7 @@ static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd,
int err = 0; int err = 0;
LIBCFS_ALLOC_GFP(buf, 1024, GFP_KERNEL); LIBCFS_ALLOC_GFP(buf, 1024, GFP_KERNEL);
if (buf == NULL) if (!buf)
return -ENOMEM; return -ENOMEM;
/* 'cmd' and permissions get checked in our arch-specific caller */ /* 'cmd' and permissions get checked in our arch-specific caller */
...@@ -329,11 +329,11 @@ static int __proc_cpt_table(void *data, int write, ...@@ -329,11 +329,11 @@ static int __proc_cpt_table(void *data, int write,
if (write) if (write)
return -EPERM; return -EPERM;
LASSERT(cfs_cpt_table != NULL); LASSERT(cfs_cpt_table);
while (1) { while (1) {
LIBCFS_ALLOC(buf, len); LIBCFS_ALLOC(buf, len);
if (buf == NULL) if (!buf)
return -ENOMEM; return -ENOMEM;
rc = cfs_cpt_table_print(cfs_cpt_table, buf, len); rc = cfs_cpt_table_print(cfs_cpt_table, buf, len);
...@@ -355,7 +355,7 @@ static int __proc_cpt_table(void *data, int write, ...@@ -355,7 +355,7 @@ static int __proc_cpt_table(void *data, int write,
rc = cfs_trace_copyout_string(buffer, nob, buf + pos, NULL); rc = cfs_trace_copyout_string(buffer, nob, buf + pos, NULL);
out: out:
if (buf != NULL) if (buf)
LIBCFS_FREE(buf, len); LIBCFS_FREE(buf, len);
return rc; return rc;
} }
...@@ -531,7 +531,7 @@ static const struct file_operations *lnet_debugfs_fops_select(umode_t mode) ...@@ -531,7 +531,7 @@ static const struct file_operations *lnet_debugfs_fops_select(umode_t mode)
void lustre_insert_debugfs(struct ctl_table *table, void lustre_insert_debugfs(struct ctl_table *table,
const struct lnet_debugfs_symlink_def *symlinks) const struct lnet_debugfs_symlink_def *symlinks)
{ {
if (lnet_debugfs_root == NULL) if (!lnet_debugfs_root)
lnet_debugfs_root = debugfs_create_dir("lnet", NULL); lnet_debugfs_root = debugfs_create_dir("lnet", NULL);
/* Even if we cannot create, just ignore it altogether) */ /* Even if we cannot create, just ignore it altogether) */
...@@ -555,8 +555,7 @@ EXPORT_SYMBOL_GPL(lustre_insert_debugfs); ...@@ -555,8 +555,7 @@ EXPORT_SYMBOL_GPL(lustre_insert_debugfs);
static void lustre_remove_debugfs(void) static void lustre_remove_debugfs(void)
{ {
if (lnet_debugfs_root != NULL) debugfs_remove_recursive(lnet_debugfs_root);
debugfs_remove_recursive(lnet_debugfs_root);
lnet_debugfs_root = NULL; lnet_debugfs_root = NULL;
} }
......
...@@ -80,11 +80,11 @@ static struct cfs_trace_page *cfs_tage_alloc(gfp_t gfp) ...@@ -80,11 +80,11 @@ static struct cfs_trace_page *cfs_tage_alloc(gfp_t gfp)
*/ */
gfp |= __GFP_NOWARN; gfp |= __GFP_NOWARN;
page = alloc_page(gfp); page = alloc_page(gfp);
if (page == NULL) if (!page)
return NULL; return NULL;
tage = kmalloc(sizeof(*tage), gfp); tage = kmalloc(sizeof(*tage), gfp);
if (tage == NULL) { if (!tage) {
__free_page(page); __free_page(page);
return NULL; return NULL;
} }
...@@ -96,9 +96,6 @@ static struct cfs_trace_page *cfs_tage_alloc(gfp_t gfp) ...@@ -96,9 +96,6 @@ static struct cfs_trace_page *cfs_tage_alloc(gfp_t gfp)
static void cfs_tage_free(struct cfs_trace_page *tage) static void cfs_tage_free(struct cfs_trace_page *tage)
{ {
__LASSERT(tage != NULL);
__LASSERT(tage->page != NULL);
__free_page(tage->page); __free_page(tage->page);
kfree(tage); kfree(tage);
atomic_dec(&cfs_tage_allocated); atomic_dec(&cfs_tage_allocated);
...@@ -107,9 +104,6 @@ static void cfs_tage_free(struct cfs_trace_page *tage) ...@@ -107,9 +104,6 @@ static void cfs_tage_free(struct cfs_trace_page *tage)
static void cfs_tage_to_tail(struct cfs_trace_page *tage, static void cfs_tage_to_tail(struct cfs_trace_page *tage,
struct list_head *queue) struct list_head *queue)
{ {
__LASSERT(tage != NULL);
__LASSERT(queue != NULL);
list_move_tail(&tage->linkage, queue); list_move_tail(&tage->linkage, queue);
} }
...@@ -127,7 +121,7 @@ int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, gfp_t gfp, ...@@ -127,7 +121,7 @@ int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, gfp_t gfp,
struct cfs_trace_page *tage; struct cfs_trace_page *tage;
tage = cfs_tage_alloc(gfp); tage = cfs_tage_alloc(gfp);
if (tage == NULL) if (!tage)
break; break;
list_add_tail(&tage->linkage, stock); list_add_tail(&tage->linkage, stock);
} }
...@@ -154,7 +148,7 @@ cfs_trace_get_tage_try(struct cfs_trace_cpu_data *tcd, unsigned long len) ...@@ -154,7 +148,7 @@ cfs_trace_get_tage_try(struct cfs_trace_cpu_data *tcd, unsigned long len)
list_del_init(&tage->linkage); list_del_init(&tage->linkage);
} else { } else {
tage = cfs_tage_alloc(GFP_ATOMIC); tage = cfs_tage_alloc(GFP_ATOMIC);
if (unlikely(tage == NULL)) { if (unlikely(!tage)) {
if ((!memory_pressure_get() || if ((!memory_pressure_get() ||
in_interrupt()) && printk_ratelimit()) in_interrupt()) && printk_ratelimit())
printk(KERN_WARNING printk(KERN_WARNING
...@@ -227,7 +221,7 @@ static struct cfs_trace_page *cfs_trace_get_tage(struct cfs_trace_cpu_data *tcd, ...@@ -227,7 +221,7 @@ static struct cfs_trace_page *cfs_trace_get_tage(struct cfs_trace_cpu_data *tcd,
} }
tage = cfs_trace_get_tage_try(tcd, len); tage = cfs_trace_get_tage_try(tcd, len);
if (tage != NULL) if (tage)
return tage; return tage;
if (thread_running) if (thread_running)
cfs_tcd_shrink(tcd); cfs_tcd_shrink(tcd);
...@@ -281,7 +275,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, ...@@ -281,7 +275,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
* warning on Linux when debugging is enabled. */ * warning on Linux when debugging is enabled. */
cfs_set_ptldebug_header(&header, msgdata, CDEBUG_STACK()); cfs_set_ptldebug_header(&header, msgdata, CDEBUG_STACK());
if (tcd == NULL) /* arch may not log in IRQ context */ if (!tcd) /* arch may not log in IRQ context */
goto console; goto console;
if (tcd->tcd_cur_pages == 0) if (tcd->tcd_cur_pages == 0)
...@@ -308,7 +302,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, ...@@ -308,7 +302,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
*/ */
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
tage = cfs_trace_get_tage(tcd, needed + known_size + 1); tage = cfs_trace_get_tage(tcd, needed + known_size + 1);
if (tage == NULL) { if (!tage) {
if (needed + known_size > PAGE_CACHE_SIZE) if (needed + known_size > PAGE_CACHE_SIZE)
mask |= D_ERROR; mask |= D_ERROR;
...@@ -389,18 +383,18 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, ...@@ -389,18 +383,18 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
console: console:
if ((mask & libcfs_printk) == 0) { if ((mask & libcfs_printk) == 0) {
/* no console output requested */ /* no console output requested */
if (tcd != NULL) if (tcd)
cfs_trace_put_tcd(tcd); cfs_trace_put_tcd(tcd);
return 1; return 1;
} }
if (cdls != NULL) { if (cdls) {
if (libcfs_console_ratelimit && if (libcfs_console_ratelimit &&
cdls->cdls_next != 0 && /* not first time ever */ cdls->cdls_next != 0 && /* not first time ever */
!cfs_time_after(cfs_time_current(), cdls->cdls_next)) { !cfs_time_after(cfs_time_current(), cdls->cdls_next)) {
/* skipping a console message */ /* skipping a console message */
cdls->cdls_count++; cdls->cdls_count++;
if (tcd != NULL) if (tcd)
cfs_trace_put_tcd(tcd); cfs_trace_put_tcd(tcd);
return 1; return 1;
} }
...@@ -423,7 +417,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, ...@@ -423,7 +417,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
cdls->cdls_next = (cfs_time_current() + cdls->cdls_delay) | 1; cdls->cdls_next = (cfs_time_current() + cdls->cdls_delay) | 1;
} }
if (tcd != NULL) { if (tcd) {
cfs_print_to_console(&header, mask, string_buf, needed, file, cfs_print_to_console(&header, mask, string_buf, needed, file,
msgdata->msg_fn); msgdata->msg_fn);
cfs_trace_put_tcd(tcd); cfs_trace_put_tcd(tcd);
...@@ -431,14 +425,14 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, ...@@ -431,14 +425,14 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
string_buf = cfs_trace_get_console_buffer(); string_buf = cfs_trace_get_console_buffer();
needed = 0; needed = 0;
if (format1 != NULL) { if (format1) {
va_copy(ap, args); va_copy(ap, args);
needed = vsnprintf(string_buf, needed = vsnprintf(string_buf,
CFS_TRACE_CONSOLE_BUFFER_SIZE, CFS_TRACE_CONSOLE_BUFFER_SIZE,
format1, ap); format1, ap);
va_end(ap); va_end(ap);
} }
if (format2 != NULL) { if (format2) {
remain = CFS_TRACE_CONSOLE_BUFFER_SIZE - needed; remain = CFS_TRACE_CONSOLE_BUFFER_SIZE - needed;
if (remain > 0) { if (remain > 0) {
va_start(ap, format2); va_start(ap, format2);
...@@ -453,7 +447,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, ...@@ -453,7 +447,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
put_cpu(); put_cpu();
} }
if (cdls != NULL && cdls->cdls_count != 0) { if (cdls && cdls->cdls_count != 0) {
string_buf = cfs_trace_get_console_buffer(); string_buf = cfs_trace_get_console_buffer();
needed = snprintf(string_buf, CFS_TRACE_CONSOLE_BUFFER_SIZE, needed = snprintf(string_buf, CFS_TRACE_CONSOLE_BUFFER_SIZE,
...@@ -783,7 +777,7 @@ int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob, ...@@ -783,7 +777,7 @@ int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,
if (copy_to_user(usr_buffer, knl_buffer, nob)) if (copy_to_user(usr_buffer, knl_buffer, nob))
return -EFAULT; return -EFAULT;
if (append != NULL && nob < usr_buffer_nob) { if (append && nob < usr_buffer_nob) {
if (copy_to_user(usr_buffer + nob, append, 1)) if (copy_to_user(usr_buffer + nob, append, 1))
return -EFAULT; return -EFAULT;
...@@ -800,7 +794,7 @@ int cfs_trace_allocate_string_buffer(char **str, int nob) ...@@ -800,7 +794,7 @@ int cfs_trace_allocate_string_buffer(char **str, int nob)
return -EINVAL; return -EINVAL;
*str = kmalloc(nob, GFP_KERNEL | __GFP_ZERO); *str = kmalloc(nob, GFP_KERNEL | __GFP_ZERO);
if (*str == NULL) if (!*str)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
...@@ -978,7 +972,7 @@ static int tracefiled(void *arg) ...@@ -978,7 +972,7 @@ static int tracefiled(void *arg)
} }
} }
cfs_tracefile_read_unlock(); cfs_tracefile_read_unlock();
if (filp == NULL) { if (!filp) {
put_pages_on_daemon_list(&pc); put_pages_on_daemon_list(&pc);
__LASSERT(list_empty(&pc.pc_pages)); __LASSERT(list_empty(&pc.pc_pages));
goto end_loop; goto end_loop;
......
...@@ -185,10 +185,10 @@ union cfs_trace_data_union { ...@@ -185,10 +185,10 @@ union cfs_trace_data_union {
extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS]; extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS];
#define cfs_tcd_for_each(tcd, i, j) \ #define cfs_tcd_for_each(tcd, i, j) \
for (i = 0; cfs_trace_data[i] != NULL; i++) \ for (i = 0; cfs_trace_data[i]; i++) \
for (j = 0, ((tcd) = &(*cfs_trace_data[i])[j].tcd); \ for (j = 0, ((tcd) = &(*cfs_trace_data[i])[j].tcd); \
j < num_possible_cpus(); \ j < num_possible_cpus(); \
j++, (tcd) = &(*cfs_trace_data[i])[j].tcd) j++, (tcd) = &(*cfs_trace_data[i])[j].tcd)
#define cfs_tcd_for_each_type_lock(tcd, i, cpu) \ #define cfs_tcd_for_each_type_lock(tcd, i, cpu) \
for (i = 0; cfs_trace_data[i] && \ for (i = 0; cfs_trace_data[i] && \
...@@ -308,8 +308,8 @@ do { \ ...@@ -308,8 +308,8 @@ do { \
#define __LASSERT_TAGE_INVARIANT(tage) \ #define __LASSERT_TAGE_INVARIANT(tage) \
do { \ do { \
__LASSERT(tage != NULL); \ __LASSERT(tage); \
__LASSERT(tage->page != NULL); \ __LASSERT(tage->page); \
__LASSERT(tage->used <= PAGE_CACHE_SIZE); \ __LASSERT(tage->used <= PAGE_CACHE_SIZE); \
__LASSERT(page_count(tage->page) > 0); \ __LASSERT(page_count(tage->page) > 0); \
} while (0) } while (0)
......
...@@ -212,7 +212,7 @@ cfs_wi_scheduler (void *arg) ...@@ -212,7 +212,7 @@ cfs_wi_scheduler (void *arg)
cfs_block_allsigs(); cfs_block_allsigs();
/* CPT affinity scheduler? */ /* CPT affinity scheduler? */
if (sched->ws_cptab != NULL) if (sched->ws_cptab)
if (cfs_cpt_bind(sched->ws_cptab, sched->ws_cpt) != 0) if (cfs_cpt_bind(sched->ws_cptab, sched->ws_cpt) != 0)
CWARN("Failed to bind %s on CPT %d\n", CWARN("Failed to bind %s on CPT %d\n",
sched->ws_name, sched->ws_cpt); sched->ws_name, sched->ws_cpt);
...@@ -343,11 +343,11 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab, ...@@ -343,11 +343,11 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab,
LASSERT(cfs_wi_data.wi_init); LASSERT(cfs_wi_data.wi_init);
LASSERT(!cfs_wi_data.wi_stopping); LASSERT(!cfs_wi_data.wi_stopping);
LASSERT(cptab == NULL || cpt == CFS_CPT_ANY || LASSERT(!cptab || cpt == CFS_CPT_ANY ||
(cpt >= 0 && cpt < cfs_cpt_number(cptab))); (cpt >= 0 && cpt < cfs_cpt_number(cptab)));
LIBCFS_ALLOC(sched, sizeof(*sched)); LIBCFS_ALLOC(sched, sizeof(*sched));
if (sched == NULL) if (!sched)
return -ENOMEM; return -ENOMEM;
strlcpy(sched->ws_name, name, CFS_WS_NAME_LEN); strlcpy(sched->ws_name, name, CFS_WS_NAME_LEN);
...@@ -376,7 +376,7 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab, ...@@ -376,7 +376,7 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab,
sched->ws_starting++; sched->ws_starting++;
spin_unlock(&cfs_wi_data.wi_glock); spin_unlock(&cfs_wi_data.wi_glock);
if (sched->ws_cptab != NULL && sched->ws_cpt >= 0) { if (sched->ws_cptab && sched->ws_cpt >= 0) {
snprintf(name, sizeof(name), "%s_%02d_%02u", snprintf(name, sizeof(name), "%s_%02d_%02u",
sched->ws_name, sched->ws_cpt, sched->ws_name, sched->ws_cpt,
sched->ws_nthreads); sched->ws_nthreads);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment