From patchwork Mon Dec 5 18:09:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien Parent X-Patchwork-Id: 702812 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3tXXpL3x0Dz9sC3 for ; Tue, 6 Dec 2016 05:09:30 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="BfU1LgHT"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2150F4B99D; Mon, 5 Dec 2016 19:09:28 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KxAbrsAOsSDg; Mon, 5 Dec 2016 19:09:27 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 25F77A7573; Mon, 5 Dec 2016 19:09:27 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 67883A7573 for ; Mon, 5 Dec 2016 19:09:24 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bY3esRmEISDp for ; Mon, 5 Dec 2016 19:09:24 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by theia.denx.de (Postfix) with ESMTPS id 271BB4B68A for ; Mon, 5 Dec 2016 19:09:21 +0100 (CET) Received: by mail-wm0-f46.google.com with SMTP id t79so101770917wmt.0 for ; Mon, 05 Dec 2016 10:09:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=91n5GPHBB2vvbvvdsmX1GR+zKzK0wpwwvnBZE7Vzibc=; b=BfU1LgHTuRIQViznG21rFwiQokiXCn0yFLAKL2+hvCBeZNalk3dpVurZl+z237Koxi kzTMWmrX4F/bBtn8sUrfls67MIrIuBVsy36Jg7nJTB7OpdDpQVUq12QIxIkwMUGu8PBx JYmkwRcc3iv3xyf01oERxew7jd5AoAGm5YvCBXiDT4ZB16tfI+4l8Lfo9Gd4btY8gOwk lPRydFZqT1ymxsffAlRAbIXy4KC4Z0cLRVSKytAhObYXR/1yyVwkvo3dIMH4bjOeuXx2 npD8/FoAxXcXUBk5/lylS+carWScpbMEWxy3KQivNGNyMJdK8aNmn7lQ+NZtJ6PaQ/XM Huhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=91n5GPHBB2vvbvvdsmX1GR+zKzK0wpwwvnBZE7Vzibc=; b=mzv3HdpL2jnDXAoUoMLyyfksnuj0XNtpMvKdz9HO3pjkzyduYuyQieE8PoIR+LwB/X fcYHvpOneedOsiBIbHv4hoEBKekd4FPOe8c+9XBuLCYN1yl4aIkZdfqtezF/nKLXhQ8d Br3rbhSwYyLODNkvDASz1MB8xhuk9elTHBNMV9G4p/PnTvcTEk9+4k898thbhXV5X/K7 8r079sdHokgL1DYDtag9wqdvACAKqzIzCLHyCr5cx6FdiV5b5jqzcxuinPQlYLCARefX G57DFWtEbO0byIG6EczkiJ8e6AODfTU5Ihg8AkNM80PR8UkrflbqUXjJca5DysebBcPl 88XA== X-Gm-Message-State: AKaTC01CPGNS8fqjbDrNNLBUTDF2ChsFK4e3kDolDuJ15HAOv08v5M1E8ReVbtFL0+QcyQmC X-Received: by 10.28.152.137 with SMTP id a131mr9966651wme.56.1480961360881; Mon, 05 Dec 2016 10:09:20 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id f126sm1268286wme.22.2016.12.05.10.09.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Dec 2016 10:09:20 -0800 (PST) From: Fabien Parent To: u-boot@lists.denx.de Date: Mon, 5 Dec 2016 19:09:10 +0100 Message-Id: <20161205180910.9631-1-fparent@baylibre.com> X-Mailer: git-send-email 2.11.0 Cc: Jagan Teki Subject: [U-Boot] [PATCH] mtd: spi: don't return -1 when scan succeed X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" In spi_flash_scan, 'ret' is initialled to -1, but 'ret' is not always used to store a return value, in that case, even when the function succeed, an error (-1) will be returned. Lets just return 0 if we hit the end of the function. Signed-off-by: Fabien Parent --- drivers/mtd/spi/spi_flash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 94c0b0063d..41fc0a6a24 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -1000,7 +1000,7 @@ int spi_flash_scan(struct spi_flash *flash) { struct spi_slave *spi = flash->spi; const struct spi_flash_info *info = NULL; - int ret = -1; + int ret; info = spi_flash_read_id(flash); if (IS_ERR_OR_NULL(info)) @@ -1166,5 +1166,5 @@ int spi_flash_scan(struct spi_flash *flash) } #endif - return ret; + return 0; }