Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2536107lqp; Mon, 25 Mar 2024 01:34:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWWwNRWJ1QKcp8itiJYQFbpoP5c3gReWFyyl7ZyHVpVCPQ0jbTh1xi1nBq9mZOx4O5uNtYX+56AUhwAeusdghrYZtk8PXFISnNNpi05eQ== X-Google-Smtp-Source: AGHT+IFdG8B1MhZIB3Uy4O+oL0XzWxURrGAMF+sDeu2x7PFhlOYR3qteB4EX1lG6vpYU/h9wmGnj X-Received: by 2002:a05:6a21:99a6:b0:1a3:4fcd:7a18 with SMTP id ve38-20020a056a2199a600b001a34fcd7a18mr7918614pzb.10.1711355655930; Mon, 25 Mar 2024 01:34:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711355655; cv=pass; d=google.com; s=arc-20160816; b=BYThQ9L8IeNWE9fU4jNF9DGtZgyvknPKIsP0CLGdeLA48XPM7DZQZtN7TAGI+NiMJj WS02xqaUybn54FrJo5lU+dsuW+e85X3RRzosbEPYVWDwDwxGsCf2hFVut0gTuUBmEZAz QDzueF7mexgHjWA/0F6zAWYVXV0I47ETNrIaYHaym5SU4jgL+G5/p0J7H89f6XO2u/Rl qoasC6MwKw8VxYqd0QZlOPqkuegt1jAyfdnNoUoKsZW5e4cK+/zVYOzXAiU1HtRjDJCT /Vvna+ZkEYMhCiF0tjxaji69pmURiiK4YMVfL8XyBjBYnunhFwJGnyo7qDUgIovG8/Nt S6Ew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hn4pxJeqQ05FmzfZWxl0Q0edvxXOrhx+pQ77AdsvpNM=; fh=wrCfqp9FeEGAPZBOSVG/ESBWjh4tvHp26vB1wAv7ks4=; b=PtjXMdGfnbfXve6alv94SKX0JjHtcpk8QFXOeb4bDFBBv1bMe+oq0UzLwdWuxZP2wM JJlULBLGfIdbgr981eBtJHIdC2GSVzAl8IpKNEHRMiGjFlkvs8YCQ1TXzoL40BXr2wMQ 20N0Qikt5KLnvYP+8gvxiXqzudYjWcDmfWx4kv344gNBEMZCBjiScQxhhQW37ojbwb8R EbyrRbvTRmLaSK278zKzuReedk9hlKy40Chah79R285LOjVz0lslvP8B7HE4a9750T3a HZdDTu7LF4BOnRsHAFMMHH+do2N9lJzsKbx2ZIDIDHx+UzZadT6ziCNanMwhy4wr1lC4 diTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GHDDKc+n; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115927-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115927-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y6-20020a056a00180600b006eaa24d66afsi3497646pfa.164.2024.03.25.01.34.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 01:34:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115927-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GHDDKc+n; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115927-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115927-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 43AEEB2B486 for ; Mon, 25 Mar 2024 08:10:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 65CCD38BD15; Mon, 25 Mar 2024 03:03:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GHDDKc+n" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B875227E15; Sun, 24 Mar 2024 23:15:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322123; cv=none; b=hQU3mYzs6Otbq2KaVewWFUb9ykf0swlt3jCpctAZ0gxFP0tko/gOLQf7UR4BOvgs8LGelcp3StBJzsdH3lqeQzc8Ox8aaTXrSxTfJYiqy6Jw0BJS5jM5BEUoL/y/WvEWV5LIBQIFbj0fTe9P/L8BioXdOHVlEPCK/RakS/tgSJY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322123; c=relaxed/simple; bh=7SWI23WUhAkr2nCTc7cnWgEVIPpewP0e2j/EvO2BqdA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nL/QTx9XN4iHDs3FP2sX9kvsMGU53LwgnYZXBztLezblr7jJIay1hPCofnIwcceDZv/zcBGr8/EKwVf7iJau5cpnrJWii0NSGHqjd2UZvraSmhnfkaq2YA7neLPoF4hoR3TKAZRK/ZwTICZWVUdMzs54sEpqRCjPyCbhgiPniGU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GHDDKc+n; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95CFAC433F1; Sun, 24 Mar 2024 23:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322122; bh=7SWI23WUhAkr2nCTc7cnWgEVIPpewP0e2j/EvO2BqdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GHDDKc+n6JDLCHupfHPpgqN6V0yq4uYFPTbcs8DCZkcM2wbFeV7c/xTMl6/gN0+JP 0zuYCStep9pkr+nOWki9arRIBcrklxdvReqEmrCozC52df5PmOJ6cBKWgH7cDVR3MM 4FpSpug4VSRXtZgrlwFBDpirHVkN/a/QcPZHyKEml8a+SoMouhX0EELmE3NaosP02S 1IhK9ymH6O4DRt5djhDWIU42v00bqN1HPcYvvpShLI3+JnJqIJSm65XWoGAIC+rQfw 4y1y6/95rhd3XkkI/LHBo0JXPLW26emLJvGUXWt6cgUK0HbjvuVmBEzbiq0TPPcTPj 4X/9stprLujAg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Bartosz Golaszewski , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.1 197/451] Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional() Date: Sun, 24 Mar 2024 19:07:53 -0400 Message-ID: <20240324231207.1351418-198-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Bartosz Golaszewski [ Upstream commit 56d074d26c5828773b00b2185dd7e1d08273b8e8 ] The optional variants for the gpiod_get() family of functions return NULL if the GPIO in question is not associated with this device. They return ERR_PTR() on any other error. NULL descriptors are graciously handled by GPIOLIB and can be safely passed to any of the GPIO consumer interfaces as they will return 0 and act as if the function succeeded. If one is using the optional variant, then there's no point in checking for NULL. Fixes: 6845667146a2 ("Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe") Signed-off-by: Bartosz Golaszewski Signed-off-by: Luiz Augusto von Dentz 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 8bfef7f81b417..2acda547f4f3e 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -2254,7 +2254,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable", GPIOD_OUT_LOW); - if (IS_ERR_OR_NULL(qcadev->bt_en) && + if (IS_ERR(qcadev->bt_en) && (data->soc_type == QCA_WCN6750 || data->soc_type == QCA_WCN6855)) { dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n"); @@ -2263,7 +2263,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl", GPIOD_IN); - if (IS_ERR_OR_NULL(qcadev->sw_ctrl) && + if (IS_ERR(qcadev->sw_ctrl) && (data->soc_type == QCA_WCN6750 || data->soc_type == QCA_WCN6855 || data->soc_type == QCA_WCN7850)) @@ -2285,7 +2285,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) default: qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable", GPIOD_OUT_LOW); - if (IS_ERR_OR_NULL(qcadev->bt_en)) { + if (IS_ERR(qcadev->bt_en)) { dev_warn(&serdev->dev, "failed to acquire enable gpio\n"); power_ctrl_enabled = false; } -- 2.43.0