From patchwork Thu Jun 20 09:17:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 167309 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1819631ilk; Thu, 20 Jun 2019 02:17:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYs6ZpH5E6oZ2GL3IBRAdoIuca4W5PBapqfvkoUUIScdlUG7/NhWLkq/COWo0Chn1I/yvc X-Received: by 2002:a17:902:d717:: with SMTP id w23mr76476686ply.275.1561022270726; Thu, 20 Jun 2019 02:17:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561022270; cv=none; d=google.com; s=arc-20160816; b=PggUn67wrrZHG2o5YgaVyQK/SbKgzr+BhwF7/wY8hUAO9MyNi5Kkmwx7TgDw1bqdp3 egC1wbj2cp0SXg3OCBjJCcXJ1Kcu/WmTa/JvWjbLj92yUKn4jDct9pkpqrKnL1zVBNsE yRJjzRkMbuxD23qdS623wYw75AjOiiCjtBT8NIuK+BB0jPJEp6X144lTs3Xr9hUVqXnv z8XWWDXJUAsB+FknSEmYcg2/xFnBAWjzNVdw9oJIPltlKEacn87XPFIakfGaWRPR7HbL 7qBBYOi19AxLbMgSpbT2+9dHIDTZjzhIu7D+8zi4g9qPFiPq/tNp8huOroYi5AVquKdi zu2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=H/N0qHE94BgVcSxh7Y7ddjnVY+VEqSIyYgrIMxgshDU=; b=G4htnP9K5umKj12pVtxzY2TQGa7KYmyw7R5VtukCYRDg/tpsg9k9WmRNO5Ks7fVuS7 4DW10axjRMsTxINi4F1WlE/tDre3UG12/smApVzAiRQEADkZL9h9GpeAxq28Hi6rAP3G zN6FLhqzSTojQmtNCbONOExDawzLqy28hKvQaN3gUk0SP2URsCT0Y7uR0sQ7YRAcu5tR TgHs2qMwUUzWtj9FocjL/fcG5pBaw7Ndez8BHPkwH42AoJHjBdUGjS3GR0nfsFqjnx3y 7eyjxsgxhqtvhxb8wxLz4ALwqS/oGNCjqMMiVvHPNRK0G7aXqly/gaOywPYUgPtjev5P 1C4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="Jdg/UCsK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si5393212pgi.236.2019.06.20.02.17.50; Thu, 20 Jun 2019 02:17:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="Jdg/UCsK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731341AbfFTJRs (ORCPT + 30 others); Thu, 20 Jun 2019 05:17:48 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:34830 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725965AbfFTJRr (ORCPT ); Thu, 20 Jun 2019 05:17:47 -0400 Received: by mail-pg1-f193.google.com with SMTP id s27so1271067pgl.2 for ; Thu, 20 Jun 2019 02:17:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=H/N0qHE94BgVcSxh7Y7ddjnVY+VEqSIyYgrIMxgshDU=; b=Jdg/UCsKPmIjRfaapYt1gOM5GjjcSZvHtz8ONkgpvHrAWlb9vbnRJMNl4MW4FbYtEw 8+YR65T2T2ap5Lwq5+sMJuahof/pFY9ZKkJuf2gUBIelzu163GN+7HW0H+Ku4aKkWBPN ITlXlxJGNrnau/yhcjNck0/pYz21gwLdhwooI29uqWwrbEgFPJe2wKt024dcE+KG+Vp+ zf//1oOezxAGYjrucQmfBYcsUrUDteM5Mwu5XAcx8yY/eRJfguZs2eY1rj5MQEHgax5R RoxM3lbwpH2LrteXty6Tn/Mx5Gh42sZZi/AojBszBTgqvPti6KKt4QFtG1yVDu7GmCB1 0krQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=H/N0qHE94BgVcSxh7Y7ddjnVY+VEqSIyYgrIMxgshDU=; b=hWlXRz9I6Mi88WTzn7JSX8H6K2MtBuPlVkXhn5l5JwBNcj3Yv/hna/zK/9Td+4xnLa 4BDf63ZMDyn2bvmcGW4Qm/uNb1SP1hGbcxTKMdmpcVP5J4kUxxOXFtVQDlL+pQuJsyCl 7AmuYTKxG8p/8oKdezsOf/DMjSdcvDrGkr7LVyYj0XvC2xXbzLfitPi2JVvwaJE9wDO7 W9ZGIv+ay7Ai3RlsUUIQduj0gLNBxWTWfE9ifVxrPlyfExlXUQ7VFmOQYLMJgUN/KjYI 3M4Xq8omRf+oybEf+sFgudYeMp0cjHCA5Q89dQepfKQNkDJ6R05+ZbXz/HoCv4wpGwXC nWBw== X-Gm-Message-State: APjAAAW8bNS+3xPKJJA7SBs9rkQr1oMsNUBDsmNPN0dc+wF9R8VAVU/Y sSdiGf3hsfJ6fRXEvdNLNzs= X-Received: by 2002:a17:90a:e38f:: with SMTP id b15mr2075612pjz.85.1561022266727; Thu, 20 Jun 2019 02:17:46 -0700 (PDT) Received: from voyager.ibm.com ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id j64sm32324138pfb.126.2019.06.20.02.17.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 20 Jun 2019 02:17:46 -0700 (PDT) From: Joel Stanley To: Vijay Khemka Cc: Arnd Bergmann , Andrew Jeffery , linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] soc: aspeed: lpc-ctrl: Fix probe error handling Date: Thu, 20 Jun 2019 18:47:38 +0930 Message-Id: <20190620091738.14683-1-joel@jms.id.au> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gcc warns that a mising "flash" phandle node leads to undefined behavior later: drivers/soc/aspeed/aspeed-lpc-ctrl.c: In function 'aspeed_lpc_ctrl_probe': drivers/soc/aspeed/aspeed-lpc-ctrl.c:201:18: error: '*((void *)&resm+8)' may be used uninitialized in this function [-Werror=maybe-uninitialized] Only set the flash base and size if we find a phandle in the device tree. Reported-by: Arnd Bergmann Signed-off-by: Joel Stanley --- drivers/soc/aspeed/aspeed-lpc-ctrl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.20.1 Reviewed-by: Andrew Jeffery Reviewed-by: Vijay Khemka diff --git a/drivers/soc/aspeed/aspeed-lpc-ctrl.c b/drivers/soc/aspeed/aspeed-lpc-ctrl.c index aca13779764a..eee26c2d8b52 100644 --- a/drivers/soc/aspeed/aspeed-lpc-ctrl.c +++ b/drivers/soc/aspeed/aspeed-lpc-ctrl.c @@ -223,10 +223,11 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev) dev_err(dev, "Couldn't address to resource for flash\n"); return rc; } + + lpc_ctrl->pnor_size = resource_size(&resm); + lpc_ctrl->pnor_base = resm.start; } - lpc_ctrl->pnor_size = resource_size(&resm); - lpc_ctrl->pnor_base = resm.start; dev_set_drvdata(&pdev->dev, lpc_ctrl);