From nobody Mon Apr 6 00:15:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD7A1C6FA82 for ; Tue, 13 Sep 2022 07:19:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230403AbiIMHTa (ORCPT ); Tue, 13 Sep 2022 03:19:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230518AbiIMHTR (ORCPT ); Tue, 13 Sep 2022 03:19:17 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12A78356EB for ; Tue, 13 Sep 2022 00:19:15 -0700 (PDT) Received: from kwepemi500023.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MRZVX4l9xzkWql; Tue, 13 Sep 2022 15:15:16 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500023.china.huawei.com (7.221.188.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 13 Sep 2022 15:19:12 +0800 From: Peng Wu To: , CC: , , Subject: [PATCH] mfd: htc-i2cpld: Fix an IS_ERR() vs NULL bug in htcpld_core_probe Date: Tue, 13 Sep 2022 07:16:59 +0000 Message-ID: <20220913071659.94677-1-wupeng58@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500023.china.huawei.com (7.221.188.76) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The gpiochip_request_own_desc() function returns error pointers on error, it doesn't return NULL. Fixes: 0ef5164a81fbf ("mfd/omap1: htc-i2cpld: Convert to a pure GPIO driver= ") Signed-off-by: Peng Wu Reviewed-by: Linus Walleij --- drivers/mfd/htc-i2cpld.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c index 97d47715aa97..b45b1346ab54 100644 --- a/drivers/mfd/htc-i2cpld.c +++ b/drivers/mfd/htc-i2cpld.c @@ -567,23 +567,26 @@ static int htcpld_core_probe(struct platform_device *= pdev) htcpld->int_reset_gpio_hi =3D gpiochip_request_own_desc(&htcpld->chip[2].= chip_out, 7, "htcpld-core", GPIO_ACTIVE_HIGH, GPIOD_OUT_HIGH); - if (!htcpld->int_reset_gpio_hi) + if (IS_ERR(htcpld->int_reset_gpio_hi)) { /* * If it failed, that sucks, but we can probably * continue on without it. */ + htcpld->int_reset_gpio_hi =3D NULL; dev_warn(dev, "Unable to request int_reset_gpio_hi -- interrupts may not= work\n"); - + } =20 htcpld->int_reset_gpio_lo =3D gpiochip_request_own_desc(&htcpld->chip[2].= chip_out, 0, "htcpld-core", GPIO_ACTIVE_HIGH, GPIOD_OUT_LOW); - if (!htcpld->int_reset_gpio_lo) + if (IS_ERR(htcpld->int_reset_gpio_lo)) { /* * If it failed, that sucks, but we can probably * continue on without it. */ + htcpld->int_reset_gpio_lo =3D NULL; dev_warn(dev, "Unable to request int_reset_gpio_lo -- interrupts may not= work\n"); + } =20 dev_info(dev, "Initialized successfully\n"); return 0; --=20 2.17.1