From patchwork Mon Oct 15 08:52:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 983965 X-Patchwork-Delegate: boris.brezillon@free-electrons.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aIOz7XCw"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aliWaR3z"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42YXJM37Nvz9s5b for ; Mon, 15 Oct 2018 19:52:35 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Azt40fv3wm8rW3pZFteqs41qILR0M3l4Oa0HyrX7ijg=; b=aIOz7XCwBn63vZ GNVXdYrLbQkbxRoJtmCpltl+y3BelPgylH+KtNo3Mv3qRJuBt7skASyRnG6618sBmfUpz5UYpoNsx /CtlB4JFdSfbuHdPZtQBGlc7n9lVPOdb3EAS2mKY12J/XwmV4BYOSGdm6Tpwg8wygmqYX3tSXgj7j +k3Gc8jJHcdwaP3hDQkfuIi8OZMaFb/SMYOFYrDsryXW7GgZaqbS7h4he/N7H+5g0b9EH1e4IMsrv sq+4yr0/3xUfX19agpkACLSneR9TpTibiZpxPAoeZ+2d9Q9QEF4AoJAaLQa6sJiN2J0YB1g3Og6au BhxMKjJF2jTU9PlNVUFg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gBybu-0005FO-8s; Mon, 15 Oct 2018 08:52:22 +0000 Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gBybq-0005Dx-T8 for linux-mtd@lists.infradead.org; Mon, 15 Oct 2018 08:52:20 +0000 Received: by mail-ed1-x541.google.com with SMTP id y19-v6so17064664edd.2 for ; Mon, 15 Oct 2018 01:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+ygTl7CGYFilU6nOBS7QCfi2qe+E/6eheJP0qfd6TeA=; b=aliWaR3zOKjPF5n444xg5vM/Of3Bvg/qg7NX/oyse6q0R/Hu0Y/hDJfALi4cyJmvWl 4tZll0dJZW5pM5QXvyDuGoVAzNsM0LhrIIkeYx86V+sJfz4sqxewiSL7ECeHdZKdaO66 ZExHbV0bL2OSLV8ILI2s26LpYVi5QRN/8H40/FQk4g5vXE4ZwqlNd6B35zBNgg31U6Lq GgmoRSe9c6oxRMdP7+pqeSNXuXhPePN2dp35TZH0uBBmTHW+hxbuTUAuh3WPFTkwfQOx OCb0UjJT+9y+2giCEEkHhP+RmE2rv/krVVehBd6Ubvxoiq5D7Q/vLCAo9lOy4PII33J3 qAFQ== 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=+ygTl7CGYFilU6nOBS7QCfi2qe+E/6eheJP0qfd6TeA=; b=t0OdD2b8tnJ9szjJk0FFAS/YJg6ybYVca8+s4kzEmnotNKGuUDkdZ3mL1nP5GarknK GW86p2gENhSZKhDnofpesfvVR3UPltKzTXnckiEcEfeuBmxLHk/MYk3yaxIh0ju6hrHH JnLRHmbQqA4SurgKQ4v3mje22MXSLE00iIgHKZlAMnpkHnz1XoeONntTlb0/CWU2HgjE 1AfVgzejIzE9KfxJ3j+msmG/iPW6qVgKTr8XwCW9pbs3FKZCQPiPxe5jse+sCdA/sz8O xJmFCUr5aP9kn9lit3KXG3kV4GuKcg2/zjr3fiokOGXovMhrt1Opo05wPtWRjvWYitv1 Y8Rw== X-Gm-Message-State: ABuFfoijnh99uMnOZky+PB1qFP5rNcLex7qsPdafJGIBSqxYsKj861tV yVCkguQyNtbNXoLTmVB4yBA= X-Google-Smtp-Source: ACcGV60421JEPRwmOdpu+pHCp9J0j7omYz/A8JZrL2x9bFzcMRK3dhHd0wywSUibfRqCHX7OJTmhmw== X-Received: by 2002:a50:8387:: with SMTP id 7-v6mr23228097edi.84.1539593526236; Mon, 15 Oct 2018 01:52:06 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id l52-v6sm4097024edc.10.2018.10.15.01.52.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Oct 2018 01:52:04 -0700 (PDT) From: Ricardo Ribalda Delgado To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH] mtd: maps: code style: Invert logic on if/else branch Date: Mon, 15 Oct 2018 10:52:02 +0200 Message-Id: <20181015085202.23921-1-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181014092638.75cda7ad@bbrezillon> References: <20181014092638.75cda7ad@bbrezillon> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181015_015219_016185_020E4B73 X-CRM114-Status: GOOD ( 16.98 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:541 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (ricardo.ribalda[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ricardo Ribalda Delgado Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org It is preferred to have the positive statement on an if/else. While we are at it we replace the way we access rom_probe_types. Signed-off-by: Ricardo Ribalda Delgado --- drivers/mtd/maps/physmap-core.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c index 85ef1142c134..cd443c1dd947 100644 --- a/drivers/mtd/maps/physmap-core.c +++ b/drivers/mtd/maps/physmap-core.c @@ -435,7 +435,6 @@ static int physmap_flash_pdata_init(struct platform_device *dev) static int physmap_flash_probe(struct platform_device *dev) { struct physmap_flash_info *info; - const char * const *probe_type; int err = 0; int i; @@ -516,14 +515,19 @@ static int physmap_flash_probe(struct platform_device *dev) simple_map_init(&info->maps[i]); } - probe_type = rom_probe_types; - if (!info->probe_type) { - for (; !info->mtds[i] && *probe_type; probe_type++) - info->mtds[i] = do_map_probe(*probe_type, - &info->maps[i]); - } else { + if (info->probe_type) { info->mtds[i] = do_map_probe(info->probe_type, &info->maps[i]); + } else { + int j; + + for (j = 0; ARRAY_SIZE(rom_probe_types); j++) { + info->mtds[i] = do_map_probe( + rom_probe_types[j], + &info->maps[i]); + if (info->mtds[i]) + break; + } } if (!info->mtds[i]) {