Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1665363ybi; Thu, 20 Jun 2019 01:31:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqw15F8BTm9e4V+zmBCsbVL8+lfJxkPeGU8x5CEFVa21fpb4JJ0qNr78HN3Pf64/7ygpw0AW X-Received: by 2002:a63:a02:: with SMTP id 2mr12116171pgk.315.1561019505773; Thu, 20 Jun 2019 01:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561019505; cv=none; d=google.com; s=arc-20160816; b=rXd2jOhRmhu0U0rGJAMs7pGjSzF0X5zpwhoF52dJ93OusW3J4vqkgafkKUzm1HuUnW o5M4fL6FU8LHfGSLdXwtMf4/11/Ft32kdr/otBUcIwnySw+KNGjrd7CnMtccs+9CPGv8 JFNmytlDs8il0PeV7WzOltoWm6OOyDsn36fUSyWTaP5mPM9MifflRq9FkdLXtn8FXkuI EYEe9UGqVjFS/jhvSYMAkK84FeTWprv6ct9fASdJvpUEDSt9wIWQzDsNsoB18PkMh+1t +HdvqZRnEfyCXIAQhM/jAxaIipi9xldES4RqRqUrB8tlEHLImrimMGcnwNb7JPZIVKUi Ii/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6+LDECNzk7Ax81lY+NTXinI2CggAW7FJancdnXbish8=; b=TSas6AOY8N/Waj8xXqOut2R1YDjka27G58SjiBqGPZiDmA+UWRVzrKh/RozJEg3kCO 5wOkqt/xv7e7KdSZ5BYXOWr9zqd95aR1M2xynzMSjEi0xcarrOMJP2JDebVtuFbp+R6w JQ3rkNzY29YUlIpUKxlUqxH6qNZ0555xjiSgUz5I1xLb1e/BPRLEgbXD6+lzFoeEPaRT hGvvjf29ElhT3KL5vf+yD2edr42gVNpsIkYZlwhp87UwBTrzivTJfwUmnIWjkWnQym+g rEDpXb7UiRIySQ5MDk1MD3oQU3Cc6bELOTNA654e6uHhpnm5E6PnuhSWeiqrNsthyrzL gXnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jms.id.au header.s=google header.b=CtuzE3Xr; 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 m3si19570118pld.40.2019.06.20.01.31.30; Thu, 20 Jun 2019 01:31:45 -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=pass header.i=@jms.id.au header.s=google header.b=CtuzE3Xr; 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 S1726246AbfFTI3u (ORCPT + 99 others); Thu, 20 Jun 2019 04:29:50 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:33932 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725875AbfFTI3u (ORCPT ); Thu, 20 Jun 2019 04:29:50 -0400 Received: by mail-qt1-f193.google.com with SMTP id m29so2413951qtu.1 for ; Thu, 20 Jun 2019 01:29:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jms.id.au; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6+LDECNzk7Ax81lY+NTXinI2CggAW7FJancdnXbish8=; b=CtuzE3XrAV1rVmsdqj11M6pmKHISAnlRUomi1TlE3HzkVaVNorKLX2wW/stFBg1Bv6 DyIHp3jITT2jE0rKVoCLPQ360+74LzXT6mmKu2+NrX5JQsoKH9lgwciuIWycQoNxySYe E/CSxBpptpTlZ//LZbwz0Wkz4IVdBnFrG+bkQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6+LDECNzk7Ax81lY+NTXinI2CggAW7FJancdnXbish8=; b=Q2Vvdg/l/bzMj7brRfaDSY7kUF5iAJpL8ugM2yuW8Fwlzmss6MoMN0San7eM4qWBPx 5ik1FfVClBGIVwnt5JMImnH0yadwAl1kPUsYrpgsjjq6URf3gJKq5ERU1wczjh+jq+lT 1OwlEV8yNkl/JnUVHqg7yndAWQ5Pat4lELf5Z+ou8bgt+aGSw01XHpLI9HIIvr9Xrrp/ 1id9EVdpLcqWiyT8ZMVbkSpxGGu0aJGAi07RNf8Sfg32f4cSfVzgM/Nv/oLfkfU4YOUO UU38g5SgO5XhnRpC9oaqFJXZOwEd1Zo4krYAursrNe9dtiJJHRjfSkXBRxAU/jAmXLxa jBjQ== X-Gm-Message-State: APjAAAXP7dD6dUSreXieFW/Y0VA89yCpi4cUUb2hLsnyEFE29sZbCpGQ +c/a/9aEpXaf/IDw9O0swuWrxngtHu+9owOWDROmpCjU7lM= X-Received: by 2002:a0c:afd5:: with SMTP id t21mr38274708qvc.105.1561019389077; Thu, 20 Jun 2019 01:29:49 -0700 (PDT) MIME-Version: 1.0 References: <20190619125636.1109665-1-arnd@arndb.de> In-Reply-To: <20190619125636.1109665-1-arnd@arndb.de> From: Joel Stanley Date: Thu, 20 Jun 2019 08:29:36 +0000 Message-ID: Subject: Re: [PATCH] soc: aspeed: fix probe error handling To: Arnd Bergmann Cc: Andrew Jeffery , Patrick Venture , Vijay Khemka , Linux ARM , linux-aspeed@lists.ozlabs.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 19 Jun 2019 at 12:56, Arnd Bergmann wrote: > > 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] > > The device cannot work without this node, so just error out here. > > Signed-off-by: Arnd Bergmann Thanks Arnd. This looks like it applies on top of Vijay's recent patch? The intent of that change was to make the driver usable for systems that do not want to depend on the flash phandle. I think the fix we want looks like this: --- a/drivers/soc/aspeed/aspeed-lpc-ctrl.c +++ b/drivers/soc/aspeed/aspeed-lpc-ctrl.c @@ -224,10 +224,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; Vijay, do you agree? Cheers, Joel > --- > drivers/soc/aspeed/aspeed-lpc-ctrl.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/soc/aspeed/aspeed-lpc-ctrl.c b/drivers/soc/aspeed/aspeed-lpc-ctrl.c > index 239520bb207e..81109d22af6a 100644 > --- a/drivers/soc/aspeed/aspeed-lpc-ctrl.c > +++ b/drivers/soc/aspeed/aspeed-lpc-ctrl.c > @@ -212,6 +212,7 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev) > node = of_parse_phandle(dev->of_node, "flash", 0); > if (!node) { > dev_dbg(dev, "Didn't find host pnor flash node\n"); > + return -ENXIO; > } else { > rc = of_address_to_resource(node, 1, &resm); > of_node_put(node); > -- > 2.20.0 >