From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by mx.groups.io with SMTP id smtpd.web11.37803.1683649949808543042 for ; Tue, 09 May 2023 09:32:30 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@gmail.com header.s=20221208 header.b=KKIfyZZB; spf=pass (domain: gmail.com, ip: 209.85.128.49, mailfrom: pedro.falcato@gmail.com) Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-3f42b984405so7544645e9.3 for ; Tue, 09 May 2023 09:32:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683649948; x=1686241948; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Zu9/9uX+9Tl4PSz3ENMKG64o2l3A1A3StUZYCGTRdNM=; b=KKIfyZZBSB1efv4TafLogs0XVSbWIfl9DbWvG5q8Z1MWoDUD0zKLJd4E9w4nasWbQ5 YM6jgxzAl9t/lokOO34pE1JUeWD7a9iMF5IQLiKV9bJulG4f4rxTInGhJyvsQ6/WN1cu AlOs6lhJOvpRbGq+TTA0tniqPbKQlfpiPBYP621IGgAMXdDg4y1vB/8NN2vd5RYviC9E uP9XComFdbiDZhv+CVBJNl72w9MyLKS7Z/vwKqteXWKqmSh9u5u0sW1a9MLA4Jb37s1J 53WckCgaDK2s+HLbhV+RHa5wOKaPWQ+xEy8WJa4kW3HlNIOAM1z26EVFpb39UKLjC/FU dJWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683649948; x=1686241948; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zu9/9uX+9Tl4PSz3ENMKG64o2l3A1A3StUZYCGTRdNM=; b=OXpCRMxt+TEV5TV+gYWerMGxqJ50MV3MuGso1Z2V/NgiRk/OArX5uNRTSldlWflfO3 fdBmOee6AKHjpp5BMyfvoCyU7/PJ8ou63GXB+TTAvho0u/4Sif9cU58ky5JKSDBmFa5d zAiREcokoF7Ihh9eCgYdqtVWPlhlOnWswO7u2OscyVqz5i4YbreRsPDm6MP+qMFXqTlJ tdPD+wusgJWe6dLrc6hxndjXEprSpnw4iWLDEkJZChy0ClFzudZ/HTT29uvBtdjHboiS Qfflk94s8FgjlZsCLo5LVL1oSHdTFRvkV7oNgbd/p8St1DuAML/cLbHNO/L1WmWC19J+ BcHw== X-Gm-Message-State: AC+VfDxWhZDWJuYI10eYVhDx3QjJKS3ORaRYW0bQHt5hlp7k94GvQTbF F4mgPO7ecxVXW/qN1Z7Pu5smasuRuwB6HRAa X-Google-Smtp-Source: ACHHUZ6yLwICZj1UgE5f1YhOmyMNA6vsMNTDIe0/PZv+xXU6QzPLjXy2ZGjwyHl5KDt9a0dbm4h/mQ== X-Received: by 2002:a7b:cc10:0:b0:3f1:7aff:e14a with SMTP id f16-20020a7bcc10000000b003f17affe14amr9355423wmh.39.1683649947973; Tue, 09 May 2023 09:32:27 -0700 (PDT) Return-Path: Received: from PC-PEDRO-ARCH.lan ([2001:8a0:7280:5801:9441:3dce:686c:bfc7]) by smtp.gmail.com with ESMTPSA id p1-20020a05600c204100b003f0a6a1f969sm20363938wmg.46.2023.05.09.09.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 09:32:27 -0700 (PDT) From: "Pedro Falcato" To: devel@edk2.groups.io Cc: Laszlo Ersek , Pedro Falcato , Jian J Wang , Liming Gao , Hao A Wu , Ray Ni , Mike Maslenkin Subject: [PATCH v2 04/12] MdeModulePkg/SataControllerDxe: Fix up ASSERTS (Private != NULL) Date: Tue, 9 May 2023 17:32:04 +0100 Message-Id: <20230509163212.291333-5-pedro.falcato@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509163212.291333-1-pedro.falcato@gmail.com> References: <20230509163212.291333-1-pedro.falcato@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ASSERT (Private != NULL) (where Private = CR(...)) is ineffective as CR(Ptr, Type, Member, Sig) either returns Ptr - offsetof(Type, Member), or ASSERTS on the signature, so it's unlikely to ever return NULL (must be passed a pointer = member's offset, or in this case, 0x4). ASSERT on This != NULL instead. Cc: Jian J Wang Cc: Liming Gao Cc: Hao A Wu Cc: Ray Ni Cc: Laszlo Ersek Cc: Mike Maslenkin Signed-off-by: Pedro Falcato --- MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c index f0ffd311d7b9..ea0116071c6a 100644 --- a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c +++ b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c @@ -611,7 +611,6 @@ SataControllerStop ( } Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (IdeInit); - ASSERT (Private != NULL); // // Uninstall the IDE Controller Init Protocol from this instance @@ -745,8 +744,8 @@ IdeInitGetChannelInfo ( { EFI_SATA_CONTROLLER_PRIVATE_DATA *Private; + ASSERT (This != NULL); Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This); - ASSERT (Private != NULL); if (Channel < This->ChannelCount) { *Enabled = TRUE; @@ -845,8 +844,8 @@ IdeInitSubmitData ( EFI_SATA_CONTROLLER_PRIVATE_DATA *Private; UINTN DeviceIndex; + ASSERT (This != NULL); Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This); - ASSERT (Private != NULL); if ((Channel >= This->ChannelCount) || (Device >= Private->DeviceCount)) { return EFI_INVALID_PARAMETER; @@ -924,8 +923,8 @@ IdeInitDisqualifyMode ( EFI_SATA_CONTROLLER_PRIVATE_DATA *Private; UINTN DeviceIndex; + ASSERT (This != NULL); Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This); - ASSERT (Private != NULL); if ((Channel >= This->ChannelCount) || (BadModes == NULL) || (Device >= Private->DeviceCount)) { return EFI_INVALID_PARAMETER; @@ -1017,8 +1016,8 @@ IdeInitCalculateMode ( EFI_STATUS Status; UINTN DeviceIndex; + ASSERT (This != NULL); Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This); - ASSERT (Private != NULL); if ((Channel >= This->ChannelCount) || (SupportedModes == NULL) || (Device >= Private->DeviceCount)) { return EFI_INVALID_PARAMETER; -- 2.40.1