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: 11006251 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA1D314BB for ; Thu, 20 Jun 2019 09:17:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99E4E285F2 for ; Thu, 20 Jun 2019 09:17:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DE32285FD; Thu, 20 Jun 2019 09:17:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 30CB3285F2 for ; Thu, 20 Jun 2019 09:17:57 +0000 (UTC) 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: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:In-Reply-To:References: List-Owner; bh=1NQn0Ah/eLxYi6hSZe4sRj0ANYppTX3Uz2N05l4CLsQ=; b=AHammphwdAt20M m18wz/vk9i7hJPJgqnDRFR0Ej/UtL948krUjeOdSJY0OMhNnq3W9wkvFtrEVGXxavMr1lzCysPSoy tC276Ezeb6rOx56tSWXxPMR+ddY5vQh7pQP78OWJkmWSo/Lj6gDpD+Ey7JU8VWz6RLZV9cLeZ+Ntf G/JOklak84k5GEKOMNLztA11IvWg3fRr20EZ1YQENWZHC7J52Bia4ustmYAuDsHB19oABuP4YqP5A +jQcpYECRHdy9wTqFdhytX75fNc2gPwhRWb/xKT9n7MF1806nTcPlax1ACIijbuNZ/AOeWxcQQ7CF EnWqrX2hn3AH06qX2DbQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdtCa-00011G-AB; Thu, 20 Jun 2019 09:17:52 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdtCW-00010O-0G for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2019 09:17:49 +0000 Received: by mail-pf1-x441.google.com with SMTP id i189so1303614pfg.10 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=OyI6fYj9D7nTHxoeyqfzsua5tekcxi58ENGOdID8Gt3aOwZc6/U+9MJTnfGvUDw0Rc VgVKi7GmUBO5IAr+NZaC205sps3Rwv/cr3VQMd/pf8QrHPtJ+F/aZioAZR5VDoeTOjnu lWk0qjAJdPmQ4Ix5cZZZ99A0sF840grOBZob9nv+vthZ79EZkKcAx/63IKe1TKBiz4rM X5tdiUc5S8oyAHGvS/1oRXYAlgRUXmlM+1wqrFAgak4WcPXn18kK6HKTpMkkB4ZVaYti wDqTxyqCH8tZhk6Q2RsEkFEazf1tSWJNFY4zCVh+foz/oA+T5OpumvyQoJaSX1ilBXbE oEhw== X-Gm-Message-State: APjAAAX38y60XBr0ltSjVmDYGH9VXd3hE32YAAZrugpquqAzCSrBCoIx QE/xsWrOQGnUfwaHZ/py4YggyxtF X-Google-Smtp-Source: APXvYqyjRU2XOSFHLaSw2NHSfqeinOcL6lcfQZPbUgKSsSNdlUUmXuhILPthF8TjGwD0ko3/VxzC9w== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190620_021748_047398_02BE5070 X-CRM114-Status: GOOD ( 11.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , linux-aspeed@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Arnd Bergmann , linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Andrew Jeffery Reviewed-by: Vijay Khemka --- drivers/soc/aspeed/aspeed-lpc-ctrl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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);