Skip to content

Commit

Permalink
genirq: Reuse existing can set affinty check
Browse files Browse the repository at this point in the history
Add a !desc check while at it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Thomas Gleixner committed Feb 19, 2011
1 parent a005677 commit bce4303
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions kernel/irq/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ int irq_can_set_affinity(unsigned int irq)
{
struct irq_desc *desc = irq_to_desc(irq);

if (!irqd_can_balance(&desc->irq_data) || !desc->irq_data.chip ||
!desc->irq_data.chip->irq_set_affinity)
if (!desc || !irqd_can_balance(&desc->irq_data) ||
!desc->irq_data.chip || !desc->irq_data.chip->irq_set_affinity)
return 0;

return 1;
Expand Down
3 changes: 1 addition & 2 deletions kernel/irq/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ static ssize_t irq_affinity_proc_write(struct file *file,
cpumask_var_t new_value;
int err;

if (!irq_to_desc(irq)->irq_data.chip->irq_set_affinity || no_irq_affinity ||
irq_balancing_disabled(irq))
if (!irq_can_set_affinity(irq) || no_irq_affinity)
return -EIO;

if (!alloc_cpumask_var(&new_value, GFP_KERNEL))
Expand Down

0 comments on commit bce4303

Please sign in to comment.