From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by mx.groups.io with SMTP id smtpd.web10.27655.1647272337847442844 for ; Mon, 14 Mar 2022 08:38:58 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@semihalf-com.20210112.gappssmtp.com header.s=20210112 header.b=c91+gpxy; spf=none, err=SPF record not found (domain: semihalf.com, ip: 209.85.208.176, mailfrom: mw@semihalf.com) Received: by mail-lj1-f176.google.com with SMTP id q5so22476947ljb.11 for ; Mon, 14 Mar 2022 08:38:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RSt3U5NuNi+GsiGbmZ6wl8wuk3nuo7u2XisKDmUUmXk=; b=c91+gpxyd7GUvY8Itgv7ruU9svWFga7uvW/a+V7rNmwh/fe0LuWUwKnaeVAfDwkaM1 ByHuIVvdDK8A6E3QNKKL9JH5A0LEC0tLwEdyU3lT5w9kS2FwuBqbIpo4GtcN55P+MjDi NZ+Xj5LDghiP/37dnf4AsbjBwS4R5wkslpOhHXRaN8+ltQduN58IDOmPmhH2Xkfhn26l JgoP7IjheSvNwj5AwmNMnJwWHo5zapogArMxUMUkc4xC5HqZLpwgZXxlFneBIyTQiBZx N3wiYUBAiHR1QaG8cv/pvH4/Nc256EBuq5gs1p7ubb6Tl5ZLkfu+kJpl6S/w6LEplrPG Dtug== 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=RSt3U5NuNi+GsiGbmZ6wl8wuk3nuo7u2XisKDmUUmXk=; b=VfdM3cVIdp0GbnojDCFiUNiCWq4j1yR13yMUYKYvm1HFSwgLsoprK/XQV0D8l1F1CR K80URUTfvhtZNnAZTVoARBe4SPH+dX83bla7vj2KfZnbyU8Kzzi/I8iPJdieajgbmjth gre6XvIF9wcBMvHOnBxtSblZMfPBnk0pxlVAWEvPAswAFtb/8Xw5H7VQ345BfDsGO9F3 L3obtPnwJsUoz9RmOI36Bro+6IMJao41dOlPE6nH1nYLiFkz71vQjSHV5p4qa6XpJDPb p+ps92VCicPyuuhKHiBctHYUhcXDMSnigkD50ePt8tdntdAkFYBreNX8KPfBUNc5SjJi slIA== X-Gm-Message-State: AOAM532q6Wi+zN9jVndWm/UVXPS3SVDRTlkNiQsp2+woW1W4WFkjxPjQ lmE0/3EhHtThHZrtrNv4Spn2kFp/Lc5bmw== X-Google-Smtp-Source: ABdhPJx7ZiWwtCDYgQFNu0lONVW0YPJl235VWwixQH220kmYkXN6j2GsDJ+ZvX6Y59jofLAnAMyK3A== X-Received: by 2002:a2e:3914:0:b0:247:f8fa:5070 with SMTP id g20-20020a2e3914000000b00247f8fa5070mr14613308lja.191.1647272336095; Mon, 14 Mar 2022 08:38:56 -0700 (PDT) Return-Path: Received: from gilgamesh.lab.semihalf.net ([83.142.187.85]) by smtp.gmail.com with ESMTPSA id b8-20020ac25628000000b004484bd1be5esm3325401lff.256.2022.03.14.08.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Mar 2022 08:38:55 -0700 (PDT) From: "Marcin Wojtas" To: devel@edk2.groups.io Cc: quic_llindhol@quicinc.com, ardb+tianocore@kernel.org, mw@semihalf.com, jaz@semihalf.com, gjb@semihalf.com, upstream@semihalf.com, sunny.Wang@arm.com Subject: [edk2-platforms PATCH 5/8] Marvell/Drivers: Pp2Dxe: Fix Pp2SnpGetStatus Date: Mon, 14 Mar 2022 16:38:34 +0100 Message-Id: <20220314153837.1885852-6-mw@semihalf.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20220314153837.1885852-1-mw@semihalf.com> References: <20220314153837.1885852-1-mw@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable This patch adds missing parameter's and SNP instance status checks in SnpGetStatus callback. Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c | 31 ++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c b/Silicon/Marvell/= Drivers/Net/Pp2Dxe/Pp2Dxe.c index 91cd573b87..8a4c4545c8 100644 --- a/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c +++ b/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c @@ -991,16 +991,43 @@ Pp2SnpGetStatus ( OUT VOID **TxBuf OPTIONAL=0D )=0D {=0D - PP2DXE_CONTEXT *Pp2Context =3D INSTANCE_FROM_SNP(Snp);=0D - PP2DXE_PORT *Port =3D &Pp2Context->Port;=0D + PP2DXE_CONTEXT *Pp2Context;=0D + PP2DXE_PORT *Port;=0D BOOLEAN LinkUp;=0D EFI_TPL SavedTpl;=0D =0D + /* Check Snp Instance. */=0D + if (Snp =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D SavedTpl =3D gBS->RaiseTPL (TPL_CALLBACK);=0D =0D + Pp2Context =3D INSTANCE_FROM_SNP (Snp);=0D +=0D + /* Check whether the driver was started and initialized. */=0D + if (Snp->Mode->State !=3D EfiSimpleNetworkInitialized) {=0D + switch (Snp->Mode->State) {=0D + case EfiSimpleNetworkStopped:=0D + DEBUG ((DEBUG_WARN, "Pp2Dxe%d: not started\n", Pp2Context->Instance)= );=0D + ReturnUnlock (SavedTpl, EFI_NOT_STARTED);=0D + case EfiSimpleNetworkStarted:=0D + DEBUG ((DEBUG_WARN, "Pp2Dxe%d: not initialized\n", Pp2Context->Insta= nce));=0D + ReturnUnlock (SavedTpl, EFI_DEVICE_ERROR);=0D + default:=0D + DEBUG ((DEBUG_WARN,=0D + "Pp2Dxe%d: wrong state: %u\n",=0D + Pp2Context->Instance,=0D + Snp->Mode->State));=0D + ReturnUnlock (SavedTpl, EFI_DEVICE_ERROR);=0D + }=0D + }=0D +=0D if (!Pp2Context->Initialized)=0D ReturnUnlock(SavedTpl, EFI_NOT_READY);=0D =0D + Port =3D &Pp2Context->Port;=0D +=0D LinkUp =3D Port->AlwaysUp ? TRUE : MvGop110PortIsLinkUp(Port);=0D =0D if (LinkUp !=3D Snp->Mode->MediaPresent) {=0D --=20 2.29.0