From patchwork Thu May 7 06:41:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 469292 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DB56014029C for ; Thu, 7 May 2015 16:41:56 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jms.id.au header.i=@jms.id.au header.b=e6Fo+BJ1; dkim-atps=neutral Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id B6E321A0B8D for ; Thu, 7 May 2015 16:41:56 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jms.id.au header.i=@jms.id.au header.b=e6Fo+BJ1; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mail-pd0-x232.google.com (mail-pd0-x232.google.com [IPv6:2607:f8b0:400e:c02::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 5E0A11A05EB for ; Thu, 7 May 2015 16:41:53 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=jms.id.au header.i=@jms.id.au header.b=e6Fo+BJ1; dkim-atps=neutral Received: by pdbnk13 with SMTP id nk13so32716901pdb.0 for ; Wed, 06 May 2015 23:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jms.id.au; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=VQZEfP/RBYIsoIP82IpYmencLkkDXj9iLGNhsepz4JU=; b=e6Fo+BJ14460SBoyXBUboN/t3rcU4zds0ucSY4uFIJs0r1XfXfqrXJ4zQ7xES3GGYg shL0anzfWIv/2vDcfQv+L8gj1HbJt+Sx6okL0emx9laPWLJgXIY2ozC2CpNp6zDHOmqN voADxKRIAI0Q29M8V/VLCOhRXoTqTZ8q34ESQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=VQZEfP/RBYIsoIP82IpYmencLkkDXj9iLGNhsepz4JU=; b=lqENkvA6YujNc4+7Y1+U0RrxELZ9TAbF5PQnB2Wwz4E08nf6KPm1F+NkOLKWYy6GT0 pFJEo0DO1y6eLw0JOm8ORzWl/ByAqFE5mQQdbnN3pGrTdm2qg7DUErjYtMTqIoBe0tKm D9dEiL+ugR9Oo7myNsJf2Y7bdeUcX5slC4bZpQiu+1TA/8pXqL15+Gh5vSwQu7PbFjnU W6tRiSD1FhpfausJNpeBu+rRrDIW34/VzI8NqMYtunkXwl/340boA7epenE/l/7cDuGv 5U4TXARxPSPa73N8FZD/EsoVDNU15NRUmIRE1FqkS37ezo8lr7fbhps0faWg44oe+LaX bfwg== X-Gm-Message-State: ALoCoQl0BJKEbxeDwxI0pY8GZT043X9V+hxTc2OchXpvErB2gzOcadODcXiTwWVfF0hoxhwi4To4 X-Received: by 10.70.62.97 with SMTP id x1mr4189250pdr.41.1430980910342; Wed, 06 May 2015 23:41:50 -0700 (PDT) Received: from icarus.au.ibm.com (220-244-113-206.static.tpgi.com.au. [220.244.113.206]) by mx.google.com with ESMTPSA id qm2sm994792pdb.57.2015.05.06.23.41.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 May 2015 23:41:49 -0700 (PDT) From: Joel Stanley To: skiboot@lists.ozlabs.org Date: Thu, 7 May 2015 16:11:23 +0930 Message-Id: <1430980885-639-2-git-send-email-joel@jms.id.au> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1430980885-639-1-git-send-email-joel@jms.id.au> References: <1430980885-639-1-git-send-email-joel@jms.id.au> Subject: [Skiboot] [PATCH 1/3] flash: Fix uninitialised variable warning X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" core/flash.c:271:14: error: variable 'flash' is used uninitialized whenever 'for' loop exits because its condition is false [-Werror,-Wsometimes-uninitialized] for (i = 0; i < ARRAY_SIZE(flashes); i++) { ^~~~~~~~~~~~~~~~~~~~~~~ core/flash.c:284:7: note: uninitialized use occurs here if (!flash) { ^~~~~ core/flash.c:271:14: note: remove the condition if it is always true for (i = 0; i < ARRAY_SIZE(flashes); i++) { ^~~~~~~~~~~~~~~~~~~~~~~ core/flash.c:257:21: note: initialize the variable 'flash' to silence this warning struct flash *flash; ^ = NULL Signed-off-by: Joel Stanley --- core/flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/flash.c b/core/flash.c index 7d32c8d..3c14bf2 100644 --- a/core/flash.c +++ b/core/flash.c @@ -254,7 +254,7 @@ int flash_register(struct flash_chip *chip, bool is_system_flash) uint32_t size, block_size; struct ffs_handle *ffs; struct dt_node *node; - struct flash *flash; + struct flash *flash = NULL; const char *name; unsigned int i; int rc;