LKML Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] irq/proc: throw error number when irq_set_affinity fails in write_irq_affinity()
@ 2017-11-08  1:55 Wen Yang
  2017-11-12 22:31 ` [tip:irq/core] genirq/proc: Return proper error code when irq_set_affinity() fails tip-bot for Wen Yaxng
  0 siblings, 1 reply; 2+ messages in thread
From: Wen Yang @ 2017-11-08  1:55 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, wen.yang99, jiang.biao2, zhong.weidong

When irq_set_affinity() fails in write_irq_affinity(), it'll not throw error number like,
https://bugzilla.kernel.org/show_bug.cgi?id=197795

This patch should fix that.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
---
 kernel/irq/proc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 7f9642a..574d41c 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -154,8 +154,9 @@ static ssize_t write_irq_affinity(int type, struct file *file,
 		 */
 		err = irq_select_affinity_usr(irq) ? -EINVAL : count;
 	} else {
-		irq_set_affinity(irq, new_value);
-		err = count;
+		err = irq_set_affinity(irq, new_value);
+		if(!err)
+			err = count;
 	}
 
 free_cpumask:
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip:irq/core] genirq/proc: Return proper error code when irq_set_affinity() fails
  2017-11-08  1:55 [PATCH] irq/proc: throw error number when irq_set_affinity fails in write_irq_affinity() Wen Yang
@ 2017-11-12 22:31 ` tip-bot for Wen Yaxng
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Wen Yaxng @ 2017-11-12 22:31 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: wen.yang99, tglx, hpa, linux-kernel, mingo, jiang.biao2

Commit-ID:  6714796edcce27f7a1845e2f79783cd51bb4799b
Gitweb:     https://git.kernel.org/tip/6714796edcce27f7a1845e2f79783cd51bb4799b
Author:     Wen Yaxng <wen.yang99@zte.com.cn>
AuthorDate: Wed, 8 Nov 2017 09:55:03 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sun, 12 Nov 2017 23:25:39 +0100

genirq/proc: Return proper error code when irq_set_affinity() fails

write_irq_affinity() returns the number of written bytes, which means
success, unconditionally whether the actual irq_set_affinity() call
succeeded or not.

Add proper error handling and pass the error code returned from
irq_set_affinity() back to user space in case of failure.

[ tglx: Fixed coding style and massaged changelog ]

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
Cc: zhong.weidong@zte.com.cn
Link: https://lkml.kernel.org/r/1510106103-184761-1-git-send-email-wen.yang99@zte.com.cn

---
 kernel/irq/proc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 6376b4a..29d6f52 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -154,8 +154,9 @@ static ssize_t write_irq_affinity(int type, struct file *file,
 		 */
 		err = irq_select_affinity_usr(irq) ? -EINVAL : count;
 	} else {
-		irq_set_affinity(irq, new_value);
-		err = count;
+		err = irq_set_affinity(irq, new_value);
+		if (!err)
+			err = count;
 	}
 
 free_cpumask:

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-08  1:55 [PATCH] irq/proc: throw error number when irq_set_affinity fails in write_irq_affinity() Wen Yang
2017-11-12 22:31 ` [tip:irq/core] genirq/proc: Return proper error code when irq_set_affinity() fails tip-bot for Wen Yaxng

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git