From patchwork Thu May 14 12:11:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1290224 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=mxl0Kmua; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49N9RY1YMXz9sV9 for ; Thu, 14 May 2020 22:13:12 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 36D7F81E3A; Thu, 14 May 2020 14:12:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="mxl0Kmua"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5C43A81E3A; Thu, 14 May 2020 14:12:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E224381E3A for ; Thu, 14 May 2020 14:12:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jagan@amarulasolutions.com Received: by mail-pl1-x643.google.com with SMTP id t16so1094753plo.7 for ; Thu, 14 May 2020 05:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LQ+w0ttycYH9hAg5qVNcqFqTsm/FNMFFgTggHGQKRsw=; b=mxl0Kmuak3BN06EA38CE30IGXaZN95qR69YhFwhXknn5HvwWyVSM42TXozoXbHSjsv JTEkpZ4nNf6JI6SCVrjFzPztdyaRT8s6lVjYn+EeIZvwqBOMErWsqqAxYw98h6KtsZDm RG2JvcP/qKUlj+A4vf6TLooq4iZ0zKDmc7c4I= 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:mime-version:content-transfer-encoding; bh=LQ+w0ttycYH9hAg5qVNcqFqTsm/FNMFFgTggHGQKRsw=; b=eVsY0HOEMkX/IP2GMP+JOXZs0lv9fTjvfAepY+CXgQ9U5opNHexfI305p7XiiIu88i qri7VqPQgv1ew9zHu+WwOiHXmPKzLlS2VWEag2o2u0Qm4TYzafEZ2frW1yQRPFLZIvPf nYOjt78U6Ru2jQu9Ku94nHbF0qmj/zYHFI4Exkx2jydnoMBipcMmMruBro3cvgdSpqtr i4cojD03LhIEeKMTD6svmft4xI8tfCMca/VbSYvMmrDLcp8gfGvJ0m3uXMST8TGTu+uI Tr5v4miiXEf/O+05qKNub/TyPuvxVtuAJAqZ8VF+Dv6j0GG7nyOCO+IR+HN+yOfdC10A R9tQ== X-Gm-Message-State: AGi0PuY/74Z53fEZcCHfDix3ATePYnGhOiQpHG2wFs1kGEgAy335EDzu ZfY7u3mxlmLxLFjVzWqPTROHZz3Jwpo= X-Google-Smtp-Source: APiQypKtEc+A/I6xzJmnMe7enHqQ0KkwJoKJNvICOnYV3pboRlGJPsH4GCN+ypX2CjBHq9qnpZwKcg== X-Received: by 2002:a17:90a:ac05:: with SMTP id o5mr36931341pjq.184.1589458321968; Thu, 14 May 2020 05:12:01 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:713c:4a0a:47eb:ffcd]) by smtp.gmail.com with ESMTPSA id r31sm2091050pgl.86.2020.05.14.05.11.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 05:11:59 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Cc: linux-amarula@amarulasolutions.com, Jagan Teki , Simon Glass , Vignesh R Subject: [PATCH 2/5] cmd: sf Drop reassignment of new into flash Date: Thu, 14 May 2020 17:41:42 +0530 Message-Id: <20200514121145.28737-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514121145.28737-1-jagan@amarulasolutions.com> References: <20200514121145.28737-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean The new pointer points to flash found and that would assign it to global 'flash' pointer for further flash operations and also keep track of old flash pointer. This would happen if the probe is successful or even failed, but current code assigning new into flash before and after checking the new. So, drop the assignment after new checks so flash always latest new pointer even if probe failed or succeed. Cc: Simon Glass Cc: Vignesh R Signed-off-by: Jagan Teki --- cmd/sf.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmd/sf.c b/cmd/sf.c index e993b3e5ad..302201c2b0 100644 --- a/cmd/sf.c +++ b/cmd/sf.c @@ -141,13 +141,10 @@ static int do_spi_flash_probe(int argc, char * const argv[]) new = spi_flash_probe(bus, cs, speed, mode); flash = new; - if (!new) { printf("Failed to initialize SPI flash at %u:%u\n", bus, cs); return 1; } - - flash = new; #endif return 0;