From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751274AbdKLWc1 (ORCPT ); Sun, 12 Nov 2017 17:32:27 -0500 Received: from terminus.zytor.com ([65.50.211.136]:36467 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750940AbdKLWcZ (ORCPT ); Sun, 12 Nov 2017 17:32:25 -0500 Date: Sun, 12 Nov 2017 14:31:13 -0800 From: tip-bot for Wen Yaxng Message-ID: Cc: wen.yang99@zte.com.cn, tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org, jiang.biao2@zte.com.cn Reply-To: wen.yang99@zte.com.cn, tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org, jiang.biao2@zte.com.cn In-Reply-To: <1510106103-184761-1-git-send-email-wen.yang99@zte.com.cn> References: <1510106103-184761-1-git-send-email-wen.yang99@zte.com.cn> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/core] genirq/proc: Return proper error code when irq_set_affinity() fails Git-Commit-ID: 6714796edcce27f7a1845e2f79783cd51bb4799b X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 6714796edcce27f7a1845e2f79783cd51bb4799b Gitweb: https://git.kernel.org/tip/6714796edcce27f7a1845e2f79783cd51bb4799b Author: Wen Yaxng AuthorDate: Wed, 8 Nov 2017 09:55:03 +0800 Committer: Thomas Gleixner 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 Signed-off-by: Thomas Gleixner Reviewed-by: Jiang Biao 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: