From patchwork Sat May 21 00:03:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 574912 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1f0e:0:0:0:0 with SMTP id hs14csp2665813mab; Fri, 20 May 2022 17:20:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykvUPuLA2F/xiFGtkv1ah8DkY10iSP0WFKFmopxw3H4ZslHmI7VgiXfkELqDAawf9I5jFl X-Received: by 2002:a05:6214:c29:b0:45a:fedd:7315 with SMTP id a9-20020a0562140c2900b0045afedd7315mr9708436qvd.59.1653092432704; Fri, 20 May 2022 17:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653092432; cv=none; d=google.com; s=arc-20160816; b=URizbrZtnN5UHLG7o2mDcs8Adaqw3Gwq0b1X8zFrfyOpACaaZ7VSla6yqK6xsBkoz9 8FgYj2Y4693Njkpi2xXgjPHoroZ/d9ctvqgXYXEEjbN7niWpL2q90xR9eVPBaOlvdX2I uypQ+dQIIHmYcRBeCJlNQZ/mHTfiE+OG50BwaQ83867vyOMf7YrhaAxrWEDbcRfrpZQt wQSQpnxBaSmszLaG9wHzT+aKZa8aFf1Ko8ZxIcpcWX1li5E/gNY+KRIDQ5LlwDFHzUIB GT94Lr9VKjgrFovKDhcaRiLG2MX2lxVnTEDDYbScRTxKstVkH5E/NKUJbN7ZtyVIXP0M /lBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CwJJmiinTbs3pTu81N0JRGdiNyaikTYskuQZDhXBbfU=; b=YEca2FSrSDKrePzWL8kguTVB+Xssxs4Y7LbwuKCptm7Fj48HsMjclxJco4ZiZgIHUJ 3GMxgCxx7tTWmJ9fufbLuVxJZWUOVo6w9hLnJx28eJUKpJ4xKQLu6/gBXq0yqjG1/F6V sBCE4rSPTm4d46X2QWB9Gr1Aj2nbnZ0QWUoBw3MZgQJ6zxXbr6NIftupChIqlp6B1XNZ ChPNMzY/9ko80ONJoi+07cBF/W9KtAV01dcr8HgaEjamtWyXJKSId3zFdusc5Ck+caoI QPbPXcy71Ij5eWHcf984U83J3z5CvTKYXIjHgglKIcAym2/YdYDvUgM40K/ZwZ3egZ9A 1L/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MwCIJoEx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q1-20020a05620a024100b006a340d3f663si359360qkn.206.2022.05.20.17.20.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 May 2022 17:20:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MwCIJoEx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsCrA-0006jX-8k for patch@linaro.org; Fri, 20 May 2022 20:20:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsCbi-00086l-4l for qemu-devel@nongnu.org; Fri, 20 May 2022 20:04:35 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:35817) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nsCbT-0003zf-3f for qemu-devel@nongnu.org; Fri, 20 May 2022 20:04:33 -0400 Received: by mail-pf1-x434.google.com with SMTP id c14so8985287pfn.2 for ; Fri, 20 May 2022 17:04:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CwJJmiinTbs3pTu81N0JRGdiNyaikTYskuQZDhXBbfU=; b=MwCIJoExiFT0E+mxTP4UhEmXRjrt3CM9wAs+IeKQInA3MasXzaggODnMn3ZOEDxN4U FjBlQUTk3c1FdSkubWKoLFaB7JnuFlp3doZLxcFXBI0Zt+SvccrVn00EkPxUqKDuvy0C ry5EFj8GRsE+9aLUAW4eugbKOR2kI+W0qFJ518CdHUtn8HXXlR+zYg6b1QHx2yVUaYxv Rjx8TBpwEDUOM+W/s5tCjEG7U6rzhJ8W+gBnje+vGAED9WsXiJavKak+wspkY6NdNaS/ aJt3mRQ5Zd3aW7ouRC5nmUH0KLalzJVJ2FSzQyhAJ9AWbBkfYwsnw6QTHuqGj/ZMZAyi m7Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CwJJmiinTbs3pTu81N0JRGdiNyaikTYskuQZDhXBbfU=; b=YfbtVo/GDRYRn3/32jMbtY/R48ye488r2Z+ssF+L3Hrt4/Lt4c8vinCu0dwaN93JiB AY43Aztt20uXVOhqBROpirR2Y5FyTUiJivYDQvTXSbZoWgE3INKM5drNVAVVTDqdELy4 y7kh6vSNhfOxBvil+s/49g8GrpPpydCD2VVZSYT2trmKVt1WTDwdvz3yRGMGl3VEcigT 9FRRbGkCGFfe9w/tsGXz0YQgoiS9OuJt/zwIVWbs1PRlfBuE+0EcTffhWYGbOsJFSntd /rv/q8ey2ng5OzQvHakbdSuPKiM1e78UaCqS18baxGCVVvgz59WOiU+5f45sJGKkfIsl t7Ew== X-Gm-Message-State: AOAM530bfcGTNxaRgvsp+YabMzbsh5K00+r0mFgCuUDhpRgr8yB/4RU3 uexLeHhZdxwC1zbspMv5CCfznrwjlcP4CA== X-Received: by 2002:a63:4d02:0:b0:3f5:db92:60b7 with SMTP id a2-20020a634d02000000b003f5db9260b7mr10817807pgb.580.1653091455938; Fri, 20 May 2022 17:04:15 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id h8-20020a654808000000b003f9d1c020cbsm306369pgs.51.2022.05.20.17.04.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 May 2022 17:04:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, alex.bennee@linaro.org Subject: [PATCH v3 11/49] semihosting: Clean up common_semi_open_cb Date: Fri, 20 May 2022 17:03:22 -0700 Message-Id: <20220521000400.454525-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220521000400.454525-1-richard.henderson@linaro.org> References: <20220521000400.454525-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use common_semi_cb to return results instead of calling set_swi_errno and common_semi_set_ret directly. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée --- semihosting/arm-compat-semi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index 8792180974..1f1c5b4c9e 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -364,15 +364,13 @@ static int common_semi_open_guestfd; static void common_semi_open_cb(CPUState *cs, target_ulong ret, target_ulong err) { - if (ret == (target_ulong)-1) { - errno = err; - set_swi_errno(cs, -1); + if (err) { dealloc_guestfd(common_semi_open_guestfd); } else { associate_guestfd(common_semi_open_guestfd, ret); ret = common_semi_open_guestfd; } - common_semi_set_ret(cs, ret); + common_semi_cb(cs, ret, err); } static target_ulong