Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp227798imu; Tue, 27 Nov 2018 11:27:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/W/ComlW0DCn/vKekyPxQDT/5Q3NVbazSYPbLCBIgsUVF148xSkn30qiuMP2MtCnubbBFuu X-Received: by 2002:a63:4665:: with SMTP id v37mr30962406pgk.425.1543346858200; Tue, 27 Nov 2018 11:27:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543346858; cv=none; d=google.com; s=arc-20160816; b=rrm/Rp3Y6duSfiZe+3BDGiIf8zBEcSl+YTOYwxFALfGvN0BgWrOn9eW8Xm7s00e4GN HF99Si/SRpoP8beSrhBBWazpRupOW+FJWggocDWzu95Q0VZ9VbQuPh+P99cmFQkfi96Q 5MTrTCQvmeLo9vmbpv0WZWWZTT4qC/MM82M1W3nH/kSMmHkyDrv+GDmCZtwbOkuhwqfj VV5t0L7bRbnFl8846PWBQxei2l2qU5AhgP4odMuU8sndmRCzF5DogAYhdqSnMybPYuzr oxka2pp1jRiEllH54iVCxYJ51aUCumjwdF9bSpbkAGiwc9W+xWPp4/I6sWW6PDQapx2J al4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=R9dIG/DpoyZLLHJSmwdt54DD3J7a590a8mspMlfqkJ0=; b=SH3yDWC/5RhzVlx6embpvNul+BfR/zLNnkSPh5bV0FBz1WvR05w/q/heAR1q2/r8a/ aZyxtmxQXxxk4kwXfUctwILv8QPu8FijkGEmh8QstVne05GfcMCGhQe5SI5I/ssFHeNQ WmTffzzaxrfa80nrGqkhlrPsD8572U7ZzXKcuCxuH7gb2rT22Ry94eE5zDjGbI8k5b5R Ajv28E0owQ1vzI1ty8hdSFtOsJDByqQOILSHsknrcFmyJ9aLsR3QvUJh/ulQXCb3pmEw 2eF3PhGEekt3SOEm+tZ5AIrTBjBKKLgJh5erGx+ztEeJjcnY3lkXnjtgw7LPO8IsQpnY 3/Vg== ARC-Authentication-Results: i=1; mx.google.com; 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 w11si4880860pfk.210.2018.11.27.11.27.22; Tue, 27 Nov 2018 11:27:38 -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; 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 S1731434AbeK1EGR (ORCPT + 99 others); Tue, 27 Nov 2018 23:06:17 -0500 Received: from www.osadl.org ([62.245.132.105]:41955 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726338AbeK1EGQ (ORCPT ); Tue, 27 Nov 2018 23:06:16 -0500 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id wARH3GeS004498; Tue, 27 Nov 2018 18:03:16 +0100 From: Nicholas Mc Guire To: Linus Walleij Cc: Bartosz Golaszewski , Matthias Brugger , Sergio Paracuellos , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Nicholas Mc Guire Subject: [PATCH V2] gpio: mt7621: pass mediatek_gpio_bank_probe() failure up the stack Date: Tue, 27 Nov 2018 18:00:18 +0100 Message-Id: <1543338018-708-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-4.2 required=6.0 tests=BAYES_00,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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!=0 and not on !ret - thanks for catching this stupid mistake ! Patch was compile tested with: omega2p_defconfig, SOC_MT7621=y, GPIOLIB=y, GPIO_MT7621=y 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 = dev->of_node; struct mtk *mtk; int i; + int ret; mtk = 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 = dev_name(dev); - for (i = 0; i < MTK_BANK_CNT; i++) - mediatek_gpio_bank_probe(dev, np, i); + for (i = 0; i < MTK_BANK_CNT; i++) { + ret = mediatek_gpio_bank_probe(dev, np, i); + if (ret) + return ret; + } return 0; } -- 2.1.4