From patchwork Mon Nov 17 08:19:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 411425 X-Patchwork-Delegate: sjg@chromium.org 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 4936A14010C for ; Mon, 17 Nov 2014 19:20:39 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 29C3E4B7EC; Mon, 17 Nov 2014 09:20:27 +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 u2TvafNRHi6s; Mon, 17 Nov 2014 09:20:26 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1D85A4B7A4; Mon, 17 Nov 2014 09:20:18 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9A4E44B725 for ; Mon, 17 Nov 2014 09:20:04 +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 4NOx3wCSkWyb for ; Mon, 17 Nov 2014 09:20:04 +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 smtp.mei.co.jp (smtp.mei.co.jp [133.183.100.20]) by theia.denx.de (Postfix) with ESMTP id AA6C54B72A for ; Mon, 17 Nov 2014 09:19:58 +0100 (CET) Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile14) with ESMTP id sAH8JnlI004183; Mon, 17 Nov 2014 17:19:49 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili11) with ESMTP id sAH8JnR30109; Mon, 17 Nov 2014 17:19:49 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi14) id sAH8JnUx018847; Mon, 17 Nov 2014 17:19:49 +0900 Received: from poodle by lomi14.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id sAH8JneE018779; Mon, 17 Nov 2014 17:19:49 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id 505A12740043; Mon, 17 Nov 2014 17:19:49 +0900 (JST) From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 17 Nov 2014 17:19:40 +0900 Message-Id: <1416212385-23800-4-git-send-email-yamada.m@jp.panasonic.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416212385-23800-1-git-send-email-yamada.m@jp.panasonic.com> References: <1416212385-23800-1-git-send-email-yamada.m@jp.panasonic.com> Cc: Tom Rini , Marek Vasut Subject: [U-Boot] [PATCH 3/8] dm: core: remove unnecessary return condition in driver lookup X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de The variable "drv" never becomes NULL because ll_entry_start() always returns a valid pointer even if there are no entries. The case "n_ents == 0" is covered by the following "for" loop. Signed-off-by: Masahiro Yamada Acked-by: Simon Glass --- drivers/core/lists.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/core/lists.c b/drivers/core/lists.c index 0aad56d..0c58ec4 100644 --- a/drivers/core/lists.c +++ b/drivers/core/lists.c @@ -25,9 +25,6 @@ struct driver *lists_driver_lookup_name(const char *name) const int n_ents = ll_entry_count(struct driver, driver); struct driver *entry; - if (!drv || !n_ents) - return NULL; - for (entry = drv; entry != drv + n_ents; entry++) { if (!strcmp(name, entry->name)) return entry;