Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751202AbdGYI1I (ORCPT ); Tue, 25 Jul 2017 04:27:08 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:11412 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750790AbdGYI1G (ORCPT ); Tue, 25 Jul 2017 04:27:06 -0400 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 25 Jul 2017 01:27:06 -0700 Subject: Re: [PATCH 1/4] gpio: tegra: Remove unnecessary check To: Thierry Reding , Linus Walleij CC: , , References: <20170724145508.7388-1-thierry.reding@gmail.com> From: Jon Hunter Message-ID: <18e56d60-db2a-00d1-bb50-6ba12b319005@nvidia.com> Date: Tue, 25 Jul 2017 09:27:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170724145508.7388-1-thierry.reding@gmail.com> X-Originating-IP: [10.21.132.162] X-ClientProxiedBy: UKMAIL101.nvidia.com (10.26.138.13) To UKMAIL101.nvidia.com (10.26.138.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1715 Lines: 60 On 24/07/17 15:55, Thierry Reding wrote: > From: Thierry Reding > > of_device_get_match_data() can never return NULL, therefore the check > for NULL values is unnecessary. > > Signed-off-by: Thierry Reding > --- > drivers/gpio/gpio-tegra.c | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c > index 17725c83821f..63ee221f9be9 100644 > --- a/drivers/gpio/gpio-tegra.c > +++ b/drivers/gpio/gpio-tegra.c > @@ -566,7 +566,6 @@ static struct lock_class_key gpio_lock_class; > > static int tegra_gpio_probe(struct platform_device *pdev) > { > - const struct tegra_gpio_soc_config *config; > struct tegra_gpio_info *tgi; > struct resource *res; > struct tegra_gpio_bank *bank; > @@ -575,17 +574,11 @@ static int tegra_gpio_probe(struct platform_device *pdev) > int i; > int j; > > - config = of_device_get_match_data(&pdev->dev); > - if (!config) { > - dev_err(&pdev->dev, "Error: No device match found\n"); > - return -ENODEV; > - } > - > tgi = devm_kzalloc(&pdev->dev, sizeof(*tgi), GFP_KERNEL); > if (!tgi) > return -ENODEV; > > - tgi->soc = config; > + tgi->soc = of_device_get_match_data(&pdev->dev); > tgi->dev = &pdev->dev; > > ret = platform_irq_count(pdev); > @@ -625,7 +618,7 @@ static int tegra_gpio_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, tgi); > > - if (config->debounce_supported) > + if (tgi->soc->debounce_supported) > tgi->gc.set_config = tegra_gpio_set_config; > > tgi->bank_info = devm_kzalloc(&pdev->dev, tgi->bank_count * Acked-by: Jon Hunter Cheers Jon -- nvpublic