From patchwork Fri Nov 24 16:20:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 119598 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2436575qgn; Fri, 24 Nov 2017 08:20:43 -0800 (PST) X-Google-Smtp-Source: AGs4zMZWW8sJERqF3Tduixh3uWRqvMc3Y1Y3O2GHaIdh2cUGEm0Q5drHZ3jVo4/nR74nFvagSLON X-Received: by 10.99.2.23 with SMTP id 23mr27554507pgc.99.1511540443174; Fri, 24 Nov 2017 08:20:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511540443; cv=none; d=google.com; s=arc-20160816; b=h198GMSUleePGm+iuipqKPaNReBF9zTpLJmG/zXBqcmQXae9D8LZB7mctd8ZjyX0gb 7CEaPCAt1/9s/zv99FKHLbwxr2fK0wh6OJ0QKyBaYlurE8RG0EYeQM+TDiJb2AuHGqie ro+lFjLUY058uacElzrc5rJCda+t2x+kU7AOyaHm162tBeOPyv18C1Rd2agloxVx+Wq6 wMKK0vAzzL1DTAvkdIRx+qAcJ7igcKt2Ahwn+47X1zgqMLrfx4JfG77tpxFxIzj3lVtn p2nvAhgsq/qbrnNpPFECgrsYZbH8ykmwNHorABZ0jsRT0Y/Nrapwe+/GtDjhXhTAVuRh /oaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=x9yK971/p8URHXN1UJmRTsGE6dIUFPJJBpvs2+yhV8g=; b=qYOYXHnrArnzi3MwCVlGaWhr7mRFZLQ1uY/LT4cMWqUVdZt5eFegkotPoMh2kcH0Gr ZZrREBuLqfv4QUlvFqcvMgUM5eMAuuODXA6sRRq8ssuj2Xv1wcc/CU0EUMpu8Aj7+ILx Tk1n43UO7Vkei6qW+EKT6YefumqgAa8OwbOw45VFS0tXCOrcCc6mnPStM4p5+gEPAYfZ KFknZt8H2pu3L/PeCsvQhmkEXsAnbnSg+9wuPnQ4S/SYhrw8/9kxWpzstS4VPQ1yQvUs MV821MaNv0vG8P1YmMz+lkpmX+1+ZIJAv5r6a0ttvJ4mfgWD3nxbo8XndSdmta6aKDj8 pzjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=F1nzBkvK; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id q75si20192280pfg.61.2017.11.24.08.20.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Nov 2017 08:20:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=F1nzBkvK; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 78473220F3C4A; Fri, 24 Nov 2017 08:16:21 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::241; helo=mail-wr0-x241.google.com; envelope-from=julien.grall@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E7032220F3C43 for ; Fri, 24 Nov 2017 08:16:19 -0800 (PST) Received: by mail-wr0-x241.google.com with SMTP id u40so20787262wrf.10 for ; Fri, 24 Nov 2017 08:20:38 -0800 (PST) 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; bh=mMuGFrfwfga4dxcOTjsK8Qf5KAouUEBFIbpC8e+wrKA=; b=F1nzBkvKkCrWmx6JUJV8mAUylIMZG8dRyQSZkh2g810ZPofZpQVInBvsI//9eS842R Ah7dcBC3JKfNkHQ9bOrgP405etKzsfVwjrH+wM00OYx0uf90Tjy8LUQpf0Ur+v8nKrgL srgj5mS+0Cny3xTa8fkW58/tE+8Z2xf/fBwhI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mMuGFrfwfga4dxcOTjsK8Qf5KAouUEBFIbpC8e+wrKA=; b=hzjsKk4Q0Mi0cFbJ8I3WLmrLl+04FDyJugL4uWap2oEr0m/xdmeBjxWWCPGdZNesnP 5tKZu/bUx758cwpMbFmohadNY1QGhxgobCRVCCbX5yR4c4UzO7YZZ6GGNnxI0/olTt6f pbRHxJx1gVL3hphzAVrBStz3PKjplZ2dr6Uv+IW+CtZeJIclp/iICaYcgWONl80XIbxr bMpjB9C9zEKvE1yjSMgX5FtppaVt9taTpxkitBea7x8bs+vzBN0epjUI+WjW/uxj4EgW 9gv1y16Un+awmD+sANpO89R+x3YO5SHeblcdKZrVTKLrFabdPsvrKhmWVmxnt8D9mEZ0 WOBw== X-Gm-Message-State: AJaThX6nyudVFP+jDhLzPCloRofFgdYBV7eXr+ZW9tjRn/vr+oAKLnkb bi/6nZlm2lLlcVNIq2aCuA/IKA== X-Received: by 10.223.181.132 with SMTP id c4mr1142490wre.42.1511540436925; Fri, 24 Nov 2017 08:20:36 -0800 (PST) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id k30sm38803840wrf.63.2017.11.24.08.20.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Nov 2017 08:20:36 -0800 (PST) From: Julien Grall To: star.zeng@intel.com, eric.dong@intel.com, pankaj.bansal@nxp.com, lersek@redhat.com, leif.lindholm@linaro.org Date: Fri, 24 Nov 2017 16:20:29 +0000 Message-Id: <20171124162030.31156-3-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171124162030.31156-1-julien.grall@linaro.org> References: <20171124162030.31156-1-julien.grall@linaro.org> Subject: [edk2] [PATCH v2 2/3] MdeModulePkg/SerialDxe: Fix return valued in SerialSetAttributes X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edk2-devel@lists.01.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" SerialSetAttributes is meant to match the behavior of the function EFI_SERIAL_IO_PROTOCOL.SetAttributes() in the UEFI spec (v2.7). This means the function can only return: - EFI_SUCCESS - EFI_INVALID_PARAMETER - EFI_DEVICE_ERROR However the function SerialPortSetAttributes may also validly return EFI_UNSUPPORTED. For instance this is the case of the Xen Console driver. EFI_UNSUPPORTED could be also interpreted as "One or more of the attributes has an unsupported value". So return EFI_INVALID_PARAMETER in that case. Lastly, to prevent another return slipping in the future, all the errors but EFI_INVALID_PARAMETERR and EFI_UNSUPPORTED will return EFI_DEVICE_ERROR. Contributed-under: Tianocore Contribution Agreement 1.1 Signed-off-by: Julien Grall --- MdeModulePkg/Universal/SerialDxe/SerialIo.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Signed-off-by: Julien Grall diff --git a/MdeModulePkg/Universal/SerialDxe/SerialIo.c b/MdeModulePkg/Universal/SerialDxe/SerialIo.c index 5946a6e2f3..08b95a4a33 100644 --- a/MdeModulePkg/Universal/SerialDxe/SerialIo.c +++ b/MdeModulePkg/Universal/SerialDxe/SerialIo.c @@ -264,8 +264,9 @@ SerialReset ( value of DefaultStopBits will use the device's default number of stop bits. - @retval EFI_SUCCESS The device was reset. - @retval EFI_DEVICE_ERROR The serial device is not functioning correctly. + @retval EFI_SUCCESS The device was reset. + @retval EFI_INVALID_PARAMETER One or more attributes has an unsupported value. + @retval EFI_DEVICE_ERROR The serial device is not functioning correctly. **/ EFI_STATUS @@ -323,8 +324,10 @@ SerialSetAttributes ( DataBits = OriginalDataBits; StopBits = OriginalStopBits; Status = EFI_SUCCESS; + } else if (Status == EFI_INVALID_PARAMETER || Status == EFI_UNSUPPORTED) { + return EFI_INVALID_PARAMETER; } else { - return Status; + return EFI_DEVICE_ERROR; } }