Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp304273imu; Tue, 27 Nov 2018 12:41:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/VzKvPaXXxX+qTvcoJCJa8aSNJL1pAQQmulRmpXi69JGSexLB6m/w6vXj0n9kMrUynGC+0h X-Received: by 2002:a63:200e:: with SMTP id g14mr30772759pgg.235.1543351302388; Tue, 27 Nov 2018 12:41:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543351302; cv=none; d=google.com; s=arc-20160816; b=TUz6FOTACjaHgSE1wBwXeHNUTOfnqC+AzkdXaYAVlq5bjk0FDULIQF1zjTPC+xQbWY hh/TWG5C3BQDDwzOMTt6pI7fX0zVgmxtCswcuhcGp4tesKkTJY14wcJyjU6E46ebt0DX WBPGIWwjW9GPZEqxgP6tkq8wyGwUs168Kr5pI7iS/SNmKAai7wjK3zCbOjIGRW35R9OG 6wRFkyGmykfStmgcW7raCTYfARsgCPnE92WKL6brdQMsgB9REOIBmsgh29Oj1lCdM5P3 +YHq7ucIqN9PNKgM92mVF3Yvkk1p9118QkPn4+gcJx7RwFNgFcStnu2+J/8nqT3xYBe7 YvPw== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+iA/aQWXG+DiB/RpnSjAmpgnI+oQ5NSrUXl6IwXjsHc=; b=bO+fD8dbmNraXUs5cmB4NbdA/NNEUb56p5YV6Pt8NabIyUnEMGHMO+CeDJFLoVaMu4 HM3TYVHhO7iCid9hacN+8s2AUcq9eKcNoC0xbEVRda753ooW4s+VLOyVI/L5SNHckEGP 896zj7ppEiZhbEeIz1KRPg4WYWRCwjDq4REGxsgF+/bia84IJDmkEBsTctqwbJJN59Aw 9ukEXM5ao/0msfGDblzd61qpf2zO2cnIY0cRwRW3XqiwpASz1l/x/4afpTqtC2SAA7Ay WvkhPQ27uIIm8qR0Cnm61Mydv/lVKWqyNdidqz6AHZbAcnkiSemPxcghjcY+ATGhkPan i4CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0V197y76; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f90si5112625plb.362.2018.11.27.12.41.25; Tue, 27 Nov 2018 12:41:42 -0800 (PST) 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=@kernel.org header.s=default header.b=0V197y76; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726719AbeK1Hht (ORCPT + 99 others); Wed, 28 Nov 2018 02:37:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:35444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726068AbeK1Hht (ORCPT ); Wed, 28 Nov 2018 02:37:49 -0500 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 95AA72145D; Tue, 27 Nov 2018 20:38:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543351122; bh=OrKIgcXat3dDm6mzK4AX60q00jnPz3jrpeSERtos1lM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=0V197y76KG7CQq+Nt9ZCCJuOSoB76rYNci9agEN2Baj6WKN6DQDHjPKwUEtqv/WCf OZ6q9AkFGp0jc3JG2U5EMX5IvZDW1jPYncPKHjcQtSa9qx3vYX2gvyclDqwhYBkhQf Auo7tXGD79oFdMpr6zk52eEVfop7eqhI4J/d+ggw= Received: by mail-wm1-f48.google.com with SMTP id y1so364594wmi.3; Tue, 27 Nov 2018 12:38:42 -0800 (PST) X-Gm-Message-State: AA+aEWb/LoJ0ZuaUkbsMmnEv+gQJHlxP2vmkkFdft00EC3LRn0HMfVne 2Cl/1vmVb+3SHreXJahznwCwDRShFfaaE2StT/4= X-Received: by 2002:a1c:4d12:: with SMTP id o18mr374576wmh.92.1543351121070; Tue, 27 Nov 2018 12:38:41 -0800 (PST) MIME-Version: 1.0 References: <1543338018-708-1-git-send-email-hofrat@osadl.org> In-Reply-To: <1543338018-708-1-git-send-email-hofrat@osadl.org> From: Sean Wang Date: Tue, 27 Nov 2018 12:38:29 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V2] gpio: mt7621: pass mediatek_gpio_bank_probe() failure up the stack To: hofrat@osadl.org Cc: Linus Walleij , sergio.paracuellos@gmail.com, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, bgolaszewski@baylibre.com, linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nicholas Mc Guire =E6=96=BC 2018=E5=B9=B411=E6=9C=8827= =E6=97=A5 =E9=80=B1=E4=BA=8C =E4=B8=8A=E5=8D=889:07=E5=AF=AB=E9=81=93=EF=BC= =9A > > The error cases of mediatek_gpio_bank_probe() would go unnoticed (except > for the dev_err() messages). The probe function should return an error > if one of the banks failed to initialize properly indicated by > not returning non-0. > > Signed-off-by: Nicholas Mc Guire Acked-by: Sean Wang > Fixes: 4ba9c3afda41 ("gpio: mt7621: Add a driver for MT7621") > --- > > V2: A logic error spoted by Sean Wang the > success case is 0 and thus returning early should be on on > ret!=3D0 and not on !ret - thanks for catching this stupid mistake ! > > Patch was compile tested with: omega2p_defconfig, SOC_MT7621=3Dy, > GPIOLIB=3Dy, GPIO_MT7621=3Dy > > Patch is against 4.20-rc3 (localversion-next is next-20181121) > > drivers/gpio/gpio-mt7621.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpio/gpio-mt7621.c b/drivers/gpio/gpio-mt7621.c > index 1ec95bc..68fca8b 100644 > --- a/drivers/gpio/gpio-mt7621.c > +++ b/drivers/gpio/gpio-mt7621.c > @@ -297,6 +297,7 @@ mediatek_gpio_probe(struct platform_device *pdev) > struct device_node *np =3D dev->of_node; > struct mtk *mtk; > int i; > + int ret; > > mtk =3D devm_kzalloc(dev, sizeof(*mtk), GFP_KERNEL); > if (!mtk) > @@ -311,8 +312,11 @@ mediatek_gpio_probe(struct platform_device *pdev) > platform_set_drvdata(pdev, mtk); > mediatek_gpio_irq_chip.name =3D dev_name(dev); > > - for (i =3D 0; i < MTK_BANK_CNT; i++) > - mediatek_gpio_bank_probe(dev, np, i); > + for (i =3D 0; i < MTK_BANK_CNT; i++) { > + ret =3D mediatek_gpio_bank_probe(dev, np, i); > + if (ret) > + return ret; > + } > > return 0; > } > -- > 2.1.4 > > > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek