Commit fcfdffe5 authored by Pat Gefre's avatar Pat Gefre Committed by Tony Luck

[IA64-SGI] Fix a possible memory leak.

Fix a possible memory leak.  Change the name of the 'new_sn_irq_info'
variable to 'tmp_sn_irq_info' since we're not really allocating a new
kernel sn_irq_info, we just getting new target information from the
PROM and replacing it in the kernel's sn_irq_info for the given irq
Signed-off-by: default avatarPatrick Gefre <pfg@sgi.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 01d1eaa2
...@@ -129,10 +129,15 @@ static void sn_end_irq(unsigned int irq) ...@@ -129,10 +129,15 @@ static void sn_end_irq(unsigned int irq)
static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask) static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask)
{ {
struct sn_irq_info *sn_irq_info = sn_irq[irq]; struct sn_irq_info *sn_irq_info = sn_irq[irq];
struct sn_irq_info *tmp_sn_irq_info;
int cpuid, cpuphys; int cpuid, cpuphys;
nasid_t t_nasid; /* nasid to target */ nasid_t t_nasid; /* nasid to target */
int t_slice; /* slice to target */ int t_slice; /* slice to target */
int status;
/* allocate a temp sn_irq_info struct to get new target info */
tmp_sn_irq_info = kmalloc(sizeof(*tmp_sn_irq_info), GFP_KERNEL);
if (!tmp_sn_irq_info)
return;
cpuid = first_cpu(mask); cpuid = first_cpu(mask);
cpuphys = cpu_physical_id(cpuid); cpuphys = cpu_physical_id(cpuid);
...@@ -140,17 +145,13 @@ static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask) ...@@ -140,17 +145,13 @@ static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask)
t_slice = cpu_physical_id_to_slice(cpuphys); t_slice = cpu_physical_id_to_slice(cpuphys);
while (sn_irq_info) { while (sn_irq_info) {
int status;
int local_widget; int local_widget;
struct sn_irq_info *new_sn_irq_info;
uint64_t bridge = (uint64_t) sn_irq_info->irq_bridge; uint64_t bridge = (uint64_t) sn_irq_info->irq_bridge;
nasid_t local_nasid = NASID_GET(bridge); nasid_t local_nasid = NASID_GET(bridge);
if (!bridge) if (!bridge)
break; /* irq is not a bridge interrupt */ break; /* irq is not a device interrupt */
new_sn_irq_info = kmalloc(sizeof(*new_sn_irq_info), GFP_KERNEL);
if (!new_sn_irq_info)
break;
if (local_nasid & 1) if (local_nasid & 1)
local_widget = TIO_SWIN_WIDGETNUM(bridge); local_widget = TIO_SWIN_WIDGETNUM(bridge);
...@@ -162,7 +163,7 @@ static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask) ...@@ -162,7 +163,7 @@ static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask)
/* allocate a new PROM sn_irq_info struct */ /* allocate a new PROM sn_irq_info struct */
status = sn_intr_alloc(local_nasid, local_widget, status = sn_intr_alloc(local_nasid, local_widget,
__pa(new_sn_irq_info), irq, t_nasid, __pa(tmp_sn_irq_info), irq, t_nasid,
t_slice); t_slice);
if (status == 0) { if (status == 0) {
...@@ -172,8 +173,8 @@ static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask) ...@@ -172,8 +173,8 @@ static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask)
sn_irq_info->irq_nasid = t_nasid; sn_irq_info->irq_nasid = t_nasid;
sn_irq_info->irq_slice = t_slice; sn_irq_info->irq_slice = t_slice;
sn_irq_info->irq_xtalkaddr = sn_irq_info->irq_xtalkaddr =
new_sn_irq_info->irq_xtalkaddr; tmp_sn_irq_info->irq_xtalkaddr;
sn_irq_info->irq_cookie = new_sn_irq_info->irq_cookie; sn_irq_info->irq_cookie = tmp_sn_irq_info->irq_cookie;
register_intr_pda(sn_irq_info); register_intr_pda(sn_irq_info);
if (IS_PCI_BRIDGE_ASIC(sn_irq_info->irq_bridge_type)) { if (IS_PCI_BRIDGE_ASIC(sn_irq_info->irq_bridge_type)) {
...@@ -184,11 +185,10 @@ static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask) ...@@ -184,11 +185,10 @@ static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask)
set_irq_affinity_info((irq & 0xff), cpuphys, 0); set_irq_affinity_info((irq & 0xff), cpuphys, 0);
} else { } else {
break; /* snp_affiity failed the intr_alloc */ break; /* snp_affinity failed the intr_alloc */
} }
kfree(new_sn_irq_info);
} }
kfree(tmp_sn_irq_info);
} }
struct hw_interrupt_type irq_type_sn = { struct hw_interrupt_type irq_type_sn = {
......
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