Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933076AbdCaLUa (ORCPT ); Fri, 31 Mar 2017 07:20:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:57297 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932701AbdCaLTx (ORCPT ); Fri, 31 Mar 2017 07:19:53 -0400 From: Juergen Gross To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Cc: boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, Juergen Gross , stable@vger.kernel.org Subject: [PATCH 1/2] xen: correct error handling in xen-acpi-processor Date: Fri, 31 Mar 2017 13:19:47 +0200 Message-Id: <20170331111948.17539-2-jgross@suse.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170331111948.17539-1-jgross@suse.com> References: <20170331111948.17539-1-jgross@suse.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1019 Lines: 30 Error handling in upload_pm_data() is rather questionable: possible errno values from called functions are or'ed together resulting in strange return values: -EINVAL and -ENOMEM would e.g. result in returning -EXDEV. Fix this by bailing out early after the first error. Cc: stable@vger.kernel.org Signed-off-by: Juergen Gross --- drivers/xen/xen-acpi-processor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c index 23e391d..3659ed3 100644 --- a/drivers/xen/xen-acpi-processor.c +++ b/drivers/xen/xen-acpi-processor.c @@ -283,8 +283,8 @@ static int upload_pm_data(struct acpi_processor *_pr) if (_pr->flags.power) err = push_cxx_to_hypervisor(_pr); - if (_pr->performance && _pr->performance->states) - err |= push_pxx_to_hypervisor(_pr); + if (!err && _pr->performance && _pr->performance->states) + err = push_pxx_to_hypervisor(_pr); mutex_unlock(&acpi_ids_mutex); return err; -- 2.10.2