From patchwork Tue Jun 9 11:31:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 6571401 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B8CADC0020 for ; Tue, 9 Jun 2015 11:31:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ECD01204E2 for ; Tue, 9 Jun 2015 11:31:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 159BA204DE for ; Tue, 9 Jun 2015 11:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753690AbbFILb0 (ORCPT ); Tue, 9 Jun 2015 07:31:26 -0400 Received: from foss.arm.com ([217.140.101.70]:50714 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753613AbbFILbZ (ORCPT ); Tue, 9 Jun 2015 07:31:25 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3E67129; Tue, 9 Jun 2015 04:31:34 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.203.153]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 705383F251; Tue, 9 Jun 2015 04:31:23 -0700 (PDT) From: Andre Przywara To: will.deacon@arm.com, marc.zyngier@arm.com Cc: penberg@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: Re: [PATCH v2 6/8] arm: prepare for instantiating different IRQ chip devices Date: Tue, 9 Jun 2015 12:31:33 +0100 Message-Id: <1433849493-27463-1-git-send-email-andre.przywara@arm.com> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1433493473-4002-7-git-send-email-andre.przywara@arm.com> References: <1433493473-4002-7-git-send-email-andre.przywara@arm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, contrary to my boasting in the cover letter I managed to accidentially drop the fix for the GIC device initialization error handling Will requested from this series. If we fail the GIC initialization sequence at some point, we should make sure to not let the gic_fd initialized, so that subsequent accesses to the GIC device fail appropriately. So the fix below should be merged in, actually a part of it already in patch 2/8. If there are no further comments, I will re-spin this series with those fixes contained in the proper patches later this week. Cheers, Andre. diff --git a/arm/gic.c b/arm/gic.c index ab0f594..5fb94c1 100644 --- a/arm/gic.c +++ b/arm/gic.c @@ -89,15 +89,21 @@ static int gic__create_device(struct kvm *kvm, enum irqchip_type type) err = ioctl(gic_fd, KVM_SET_DEVICE_ATTR, &redist_attr); break; default: - return -ENODEV; + err = -ENODEV; + break; } if (err) - return err; + goto out_err; err = ioctl(gic_fd, KVM_SET_DEVICE_ATTR, &dist_attr); if (err) - return err; + goto out_err; + + return err; +out_err: + close(gic_fd); + gic_fd = -1; return err; }