Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3663224pxb; Mon, 24 Jan 2022 14:47:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzK5CfgfciCzEHD2kJouXkC5KKH/yg2mQbuuDr3cqqJNI80YaPM5GvNgTpUe5TVE0YymW+r X-Received: by 2002:a63:190d:: with SMTP id z13mr13611105pgl.352.1643064440133; Mon, 24 Jan 2022 14:47:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643064440; cv=none; d=google.com; s=arc-20160816; b=0KQmufKfCa6ohOu6ef2KV+crdVkbmeJ1FB0cySVSUrfq8H9aSmXihRdxkasomlGerD Ioy8gloPnj/YIxRRkQY0WPMUs7fj29Aec62Yc/PmH0H6NzDAai82R9exZA3IxMUrvi63 1fvuPL5skybn9jJECgbZOZDrBxuPcGmBzSHcHf2ARhTKpWMNU10LGiYg+cRRuziEuTNi K3/7bcyN6lqIZPg5WwJkuvdLg2lIYu3eZBwrsIuv53WeJj0wFOmGrgiyC0o2UjCeylQ7 x9g9rF39CmhkNCIy+AsISzvyOKoMyry54rBTXovc3J8MikeQop22m2eGHwqRtNfXOP+J UnvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JSnLHAJjZY90t+VVnpvSK+COq6tZCtSVL3aL4ONNxJs=; b=jXUefORjjssmwiLgciZ2jh0I0NMgl5gMXrp/FUcVyIZyf2EoPMUr99zaBsMJKnq1Kd Q3d+VZ7WE3ze9Epx3d37OmRhe6pSy3o8OvEXE/+E2WOE9tNzkC4NI3hegFzz9qO5mHn0 xbYQvPyNC0KIYLCUjZVdGBLfVtWFHg83Ts9Yo3/oNJxXs+i3xORFy7ZbdxokicdqXwiv AY0q1ww2Bg96uyqyMwV+gUoo1UPk/7zlKG5n+oq2bWqLD+VNgPH78zqZpWZ+fQ1ZrDlX hNQjaLXeCgHxnY0c7AGOiLDEnjaNGNRTqsYuD1G/Jd1EmjXw9eBOVgsvCD3l1Jr6Qb2l 0NOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JpYJyCdI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p4si13306627pll.2.2022.01.24.14.47.08; Mon, 24 Jan 2022 14:47:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JpYJyCdI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382333AbiAXWoH (ORCPT + 99 others); Mon, 24 Jan 2022 17:44:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456653AbiAXVjo (ORCPT ); Mon, 24 Jan 2022 16:39:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63ED4C0419C2; Mon, 24 Jan 2022 12:26:01 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0215B614ED; Mon, 24 Jan 2022 20:26:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB0B7C340E7; Mon, 24 Jan 2022 20:25:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055960; bh=AUggMRAI+OEjWQOKaYYLxIrciToOUvNb+58T72dqe1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JpYJyCdIYil8o3r1jUjX6E0OAF22pHYHP0aOTLAMintQ2MS8AEDgm38Lbx2POX/fo QM7SPy4EAM/m7VwxWCDxvF2RZ7CuYW5GC8Fobbpl9+9dpsO95veUH8AFeKELDhP+GR bauh/SNM316UrQ+Ke9SB00tTxwNq3h+gm4GSEbdc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.15 322/846] Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe Date: Mon, 24 Jan 2022 19:37:19 +0100 Message-Id: <20220124184112.008828740@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaoqian Lin [ Upstream commit 6845667146a28c09b5dfc401c1ad112374087944 ] The function devm_gpiod_get_index() return error pointers on error. Thus devm_gpiod_get_index_optional() could return NULL and error pointers. The same as devm_gpiod_get_optional() function. Using IS_ERR_OR_NULL() check to catch error pointers. Fixes: 77131dfe ("Bluetooth: hci_qca: Replace devm_gpiod_get() with devm_gpiod_get_optional()") Signed-off-by: Miaoqian Lin Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- drivers/bluetooth/hci_qca.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 3c26fc8463923..8eb7fddfb9300 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -2058,14 +2058,14 @@ static int qca_serdev_probe(struct serdev_device *serdev) qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable", GPIOD_OUT_LOW); - if (!qcadev->bt_en && data->soc_type == QCA_WCN6750) { + if (IS_ERR_OR_NULL(qcadev->bt_en) && data->soc_type == QCA_WCN6750) { dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n"); power_ctrl_enabled = false; } qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl", GPIOD_IN); - if (!qcadev->sw_ctrl && data->soc_type == QCA_WCN6750) + if (IS_ERR_OR_NULL(qcadev->sw_ctrl) && data->soc_type == QCA_WCN6750) dev_warn(&serdev->dev, "failed to acquire SW_CTRL gpio\n"); qcadev->susclk = devm_clk_get_optional(&serdev->dev, NULL); @@ -2087,7 +2087,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable", GPIOD_OUT_LOW); - if (!qcadev->bt_en) { + if (IS_ERR_OR_NULL(qcadev->bt_en)) { dev_warn(&serdev->dev, "failed to acquire enable gpio\n"); power_ctrl_enabled = false; } -- 2.34.1