Commit 8303f683 authored by Tadeusz Struk's avatar Tadeusz Struk Committed by Doug Ledford

IB/hfi1: Allocate cpu mask on the heap to silence warning

If CONFIG_FRAME_WARN is small (1K) and CONFIG_NR_CPUS big
then a frame size warning is triggered during build.
Allocate the cpu mask dynamically to silence the warning.
Reviewed-by: default avatarSebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: default avatarTadeusz Struk <tadeusz.struk@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 5412352f
...@@ -682,7 +682,7 @@ int hfi1_set_sdma_affinity(struct hfi1_devdata *dd, const char *buf, ...@@ -682,7 +682,7 @@ int hfi1_set_sdma_affinity(struct hfi1_devdata *dd, const char *buf,
size_t count) size_t count)
{ {
struct hfi1_affinity_node *entry; struct hfi1_affinity_node *entry;
struct cpumask mask; cpumask_var_t mask;
int ret, i; int ret, i;
spin_lock(&node_affinity.lock); spin_lock(&node_affinity.lock);
...@@ -692,19 +692,24 @@ int hfi1_set_sdma_affinity(struct hfi1_devdata *dd, const char *buf, ...@@ -692,19 +692,24 @@ int hfi1_set_sdma_affinity(struct hfi1_devdata *dd, const char *buf,
if (!entry) if (!entry)
return -EINVAL; return -EINVAL;
ret = cpulist_parse(buf, &mask); ret = zalloc_cpumask_var(&mask, GFP_KERNEL);
if (!ret)
return -ENOMEM;
ret = cpulist_parse(buf, mask);
if (ret) if (ret)
return ret; goto out;
if (!cpumask_subset(&mask, cpu_online_mask) || cpumask_empty(&mask)) { if (!cpumask_subset(mask, cpu_online_mask) || cpumask_empty(mask)) {
dd_dev_warn(dd, "Invalid CPU mask\n"); dd_dev_warn(dd, "Invalid CPU mask\n");
return -EINVAL; ret = -EINVAL;
goto out;
} }
mutex_lock(&sdma_affinity_mutex); mutex_lock(&sdma_affinity_mutex);
/* reset the SDMA interrupt affinity details */ /* reset the SDMA interrupt affinity details */
init_cpu_mask_set(&entry->def_intr); init_cpu_mask_set(&entry->def_intr);
cpumask_copy(&entry->def_intr.mask, &mask); cpumask_copy(&entry->def_intr.mask, mask);
/* /*
* Reassign the affinity for each SDMA interrupt. * Reassign the affinity for each SDMA interrupt.
*/ */
...@@ -720,8 +725,9 @@ int hfi1_set_sdma_affinity(struct hfi1_devdata *dd, const char *buf, ...@@ -720,8 +725,9 @@ int hfi1_set_sdma_affinity(struct hfi1_devdata *dd, const char *buf,
if (ret) if (ret)
break; break;
} }
mutex_unlock(&sdma_affinity_mutex); mutex_unlock(&sdma_affinity_mutex);
out:
free_cpumask_var(mask);
return ret ? ret : strnlen(buf, PAGE_SIZE); return ret ? ret : strnlen(buf, PAGE_SIZE);
} }
......
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