From patchwork Wed Jul 31 15:20:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 815748 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACDD01BC06D for ; Wed, 31 Jul 2024 15:21:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722439266; cv=none; b=kElrIqKf7jC8K+S8b2NrigYPVRWWWuwASQo+Qw5Yoa1cMMq2DKEfTUGr7s6lv4g6GJMjVe/mdohJKQANsYDzbUuUEk4dlt7OUxZ81cytlPNvPPskvKeFeZC4HA7dpmANwCMxMrCYs4rz6ggwKHkZSkyvVVEamtIxGk1fANz1+Ug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722439266; c=relaxed/simple; bh=zswNoI+O50GZIlRez3sOlhQLLckzIM5bFpKXGIFJOeI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lCGIjVy31+wN4nybejU5HfEaUrpZ/HDKo69KKMkckQ0uAqdJCeP2UzxyFBhJk3Lp/coNj7S3/Tjuek0Vh+ry5f1smvstfuo3oGzlMEnWPfSjYBtbl2abTZTYcdzZd+/XMrxHG4GK3yUrZBatt1QtPg8CBb23Tz5KcajYhODdlNQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=kWyTzPXw; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="kWyTzPXw" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-42808071810so38076045e9.1 for ; Wed, 31 Jul 2024 08:21:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1722439262; x=1723044062; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=seGLREnX7OFM1G9ARfOjIKh5OQ+OBIGU0JJ2UIP2zUI=; b=kWyTzPXwZxQF1IsdIu/goFjxsAh4frI8c+EWpyOfJpaAmP6IcYOLz01OVjjM71XQML A6kSjl6QRJENw62Di8EZanJQHAhPb2zsHxO0Ogz37TAC1DnCCDFP3HNA8Nl48iUxYgyk 2doif6IjHTSmk7kByUdTZ9XXhTRQF5mYeH/UQadNikCMHUF7iorSJHaylfiqONfJWl2G KfNbImisFQF3ZZ9sU2/sWg+SfyBkoPV6vt1gFZXoboMiD7q+zBXZvCFxCaf0Cd/XFNnu UDM8a6JFRhc0pV/fCgSONkvpUtNeE7FpXMXTF5wuph7xzYvaXla5TZNovJ3RPS9qwNzD hubQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722439262; x=1723044062; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=seGLREnX7OFM1G9ARfOjIKh5OQ+OBIGU0JJ2UIP2zUI=; b=AIcQtvm8Lui2a9u4hmS8NZ2VDWaTbPZ/W7ezMY5UCHBDZQ+6NmdV/FYNgvz1OnzKoP H8xdhKl6sPwHJa7TBd3HbgR4VOH2ZNtiAd7uJFBs/oecL4wQLM7ICXJoxB/Ata83Zbx/ OX7gU3s9S5r6cSO/Rpx+1XeBFVDWtOwIAMuHOCA28OqnofHuDNzwKBewQ3lsUc4fd6WO Xi2yax9M7potNvvrG84dAB2IjcxGRqWVlgFayGkrayiwvtFqSVX8ITDcBRUsHGeXYXL2 Fww/Aqv/YO7lgFFm9nTSkX25rD/elo/wSUp2WztJKTlw7+m8CSuCYRyvDkFzoweedDZ2 nr/g== X-Forwarded-Encrypted: i=1; AJvYcCUUWGCeQ4JofCxKfJpJzQ04lYC9yLohjZQ4QOYzv97k/MFGEevtMNN1Z2tC7qTGj6uu9TEPBu6JXakP9xBK8pFUPKDQ3oTIRTItjCLWs6RG X-Gm-Message-State: AOJu0YxOX4U92FXfP7LRToYB3v4QovEUklmLwuLA3LYuX29jVvw64fFt HDdzDPTSF0qtZWUJb8fji3aOydytVkuw7ui0A8/XHtteZ3tEPX1H57LLzV0CVnk= X-Google-Smtp-Source: AGHT+IGnNnpozXh545R47gaPDDj+PQCgiw+Y3QMUcPdZxnbLUZ+343A1z8hW65JSeAk561KptY8EjQ== X-Received: by 2002:a05:600c:3502:b0:426:593c:9361 with SMTP id 5b1f17b1804b1-42811e12ceemr105409675e9.26.1722439261785; Wed, 31 Jul 2024 08:21:01 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:9c3f:3dd8:b524:cb31]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4282b8addd6sm24752925e9.20.2024.07.31.08.21.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 08:21:01 -0700 (PDT) From: Bartosz Golaszewski Date: Wed, 31 Jul 2024 17:20:48 +0200 Subject: [PATCH 1/3] Bluetooth: hci_qca: don't call pwrseq_power_off() twice for QCA6390 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240731-hci_qca_fixes-v1-1-59dad830b243@linaro.org> References: <20240731-hci_qca_fixes-v1-0-59dad830b243@linaro.org> In-Reply-To: <20240731-hci_qca_fixes-v1-0-59dad830b243@linaro.org> To: Marcel Holtmann , Luiz Augusto von Dentz , Wren Turkal , Dmitry Baryshkov Cc: Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=948; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=XGFL64JDfLMIkMon2S7BTiAEZj1+aydkdFjiwnS6XCE=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBmqlZbLbl7JeGvR6pZu+/H7Xa5O/jb02pslfVyw wcBWkaFhceJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCZqpWWwAKCRARpy6gFHHX cu5DD/9m3EwwUlinlHdBdD7URJamNyyKLeonKCDJ4RmLR9CNEt9zk1JfNBiWXW6+XG4xf2hrtgr otrGMOBlWGXN2USgGSwOY1DUjHzoPtuQg7GuWsjdCGmJ6+h6M87zsu+WGC+8rDh5Z88znLILbws lfh0aH0sieC+Yy1LAVqvesdef/U2002iJjBQH8MqRxF4p27yw6Mx0B9JcdyqNCNWKAysD0R3hdY rM2hq3/HKKWh1cUADLG4rok5z1fnVB85T21wDi91AuL9Sv2RVfEhEVJPJ6HlGf3jeHnoDTt0vOO bVLiw5alz6z4xldcgf/uBFIYd/ZzgtKp4H5DgwD1PTws6NqW2QFTwSOcVuGxEFacTQ4nnkit9/9 ojN32NyOaDK0gqFvFnXJ5WTj1AaoHk/zJ1c9WJ9OhsrTsPT4ABBKy4TP+Gjg0NtyChZD6IDSiVs V3ieLYVRRdrOoq4AAFYyMxcaD+ruJ65+SW0zx+hI1kTySmpALtRfqW76UepP+9Osk06n3K1Kpyr 14oLrfYTDUMOIp+Eydz0o+Pyev+kxMLd6o0aCPxZp1x8iNbzhpiOkgQABNUN5JtVv/0b0vevE1P vhBWCB6hUyZ5AKhW/6WauWjCnFwq06xDiiB9YFAamW7Z6ihtcXjb9pMs/dRJJQhhp2ngUyQ+eRp Z9B+AXjZ2METuXw== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski Now that we call pwrseq_power_off() for all models that hold a valid power sequencing handle, we can remove the switch case for QCA_6390. The switch will now use the default label for this model but that's fine: if it has the BT-enable GPIO than we should use it. Fixes: eba1718717b0 ("Bluetooth: hci_qca: make pwrseq calls the default if available") Signed-off-by: Bartosz Golaszewski --- drivers/bluetooth/hci_qca.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index ca6466676902..a20dd5015346 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -2187,10 +2187,6 @@ static void qca_power_shutdown(struct hci_uart *hu) } break; - case QCA_QCA6390: - pwrseq_power_off(qcadev->bt_power->pwrseq); - break; - default: gpiod_set_value_cansleep(qcadev->bt_en, 0); } From patchwork Wed Jul 31 15:20:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 815747 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7043B1BC072 for ; Wed, 31 Jul 2024 15:21:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722439266; cv=none; b=m76woJgX+ADZ/LKNyEgX4JeSQr7cGCtoMGsZLdDgPjpYjN4HxIocMXYZJOLvcuSj47WMuv+Wu5HvMhJhBIOuHGV77Rkx+u0lMiG+dIETy2/q8VgqNxddwPLBUPgTJqTKdXFo85yNfQidN1G2Cz5sNxWBiWPFDGgdXNwSglJPU88= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722439266; c=relaxed/simple; bh=mnsFfjsXyLCpcHqVRuLDx+XTYSAgSLLlD1CQjdlWwhI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=l10fN/8RpjEOFgWSo7dsL+p7YpcirpMjvgb1WIBbGRI/K49Actv203IQZ0+e2Q4Y2XtQj6s+gPeGhhSeFqFBwrA086aD2ssEOOjYWJIBt/8r6oYWnTquu5W1bP8fl74rTpz14N/4KvGzMi3r2dos2GZKcRm173HwsIcpmZT03sU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=xk2smTWr; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="xk2smTWr" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-42817f1eb1fso33118055e9.1 for ; Wed, 31 Jul 2024 08:21:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1722439263; x=1723044063; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=PPgFx6S9AzTv/56jUbfitvD1CUFmclbA7VamQiWR1as=; b=xk2smTWrgNVg9aojipP3TqIeLQj0GJwwm458mp/dGVmRiDCD/UzeXcs6k0+QWIKQ7A brNPI4EjxSQAyoCB3jhll5J8n2hNXqDYl47YOwimSaQTEeTMsSIH55ZbN8Dja2wmeYqC AfpoyUYPVXZLqMlGZOY1rX7laSwQMni5UmWfDUIm5SopDxdu1aCVQMM/vw3EnQM5CkEH AFmUEkD6R+L3tVGhBGMNl0juL75XCVmmPwRDJQ7jWkdhD0TFPORzf/2kUX2OT32462Vl y/3est4KEJYK1pE3arESLWF+bKU8014sFsDUCG0UOoAetykres9iNFXOu0V3PIuE4MFF V0MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722439263; x=1723044063; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PPgFx6S9AzTv/56jUbfitvD1CUFmclbA7VamQiWR1as=; b=lEMXx9XhyXRQzb/KZGofUyTkhcFnzwKhBfvmm6KSpCGgDfaFYOhDuYYLzBEyLqNc4z gff6s8pcp90NTFShpMAc0uL9kH+ALw5wVSwJdQ6DeCcY2L3OEzkWeQt/uDDvGBpB/DzP T7+67a1e1svTYmkSajkdLhu0b8H5xu696ax+3Nq5MNKsbLnln2sPbVsWd3ASQlsIYoOr BwwZZLVSGGQQInFMlj/ayN7acREL1ZnE9sA42ATBYyiC0m7cKlljCA02rTRcXNlIlnIs 2pZzzqMVNghPwbFgmurNuWFAPJoWta5GWtOnj8AbvANeCDrfq/DW34Q5Gv/pFqP2Nm0l p9Pg== X-Forwarded-Encrypted: i=1; AJvYcCXvf7o4KvScmYZfBIFXEZAEy2Nap5R+sgnY05FfA+nKNygoevACsS7BZ1+jusfBwTtfH43ViaqX9cRcoaf6fLc=@vger.kernel.org X-Gm-Message-State: AOJu0YxLGUTIj6/iVoS/Td6wrcQtAKf9aY3iBLi27XcL+7DuHg/igc0i eWYVpyjxLPrdmWIQcKIKCIrfRfqc0ryV7Jsmj4R36Jdby03DBWX4n3tAvG0+YcQ= X-Google-Smtp-Source: AGHT+IHClkBhl81RbhbhQwvb71V6F2Gv1oAzwjiUmbWV0cXrXma4jczdTf7X7a33LPe5bCg9giE3HA== X-Received: by 2002:a05:600c:46c8:b0:427:d8f2:550 with SMTP id 5b1f17b1804b1-42811d9a644mr114725735e9.14.1722439262498; Wed, 31 Jul 2024 08:21:02 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:9c3f:3dd8:b524:cb31]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4282b8addd6sm24752925e9.20.2024.07.31.08.21.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 08:21:02 -0700 (PDT) From: Bartosz Golaszewski Date: Wed, 31 Jul 2024 17:20:49 +0200 Subject: [PATCH 2/3] Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240731-hci_qca_fixes-v1-2-59dad830b243@linaro.org> References: <20240731-hci_qca_fixes-v1-0-59dad830b243@linaro.org> In-Reply-To: <20240731-hci_qca_fixes-v1-0-59dad830b243@linaro.org> To: Marcel Holtmann , Luiz Augusto von Dentz , Wren Turkal , Dmitry Baryshkov Cc: Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1545; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=Ga1opdpymbhkU9R1JhuG60TILNDZdSmzqdrgmgVV3PI=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBmqlZcBgQ6G7JKZlOYHDPZ6H9v/UOairIpBeC8C LZhczsp6YCJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCZqpWXAAKCRARpy6gFHHX chMRD/9i9QXxsGdNawfMfGnpI37fW2Bx2vn/GP0x74mQ7mLMd9rVGpghAT6q8wJABaq/BreCtJm woeGTIGsKJOFPdWfCrCOAO/F6v+7UQisQt9RGhmXL0elSElvZ3HL+N1dPAo7KOtDuJEiqnirv9P 6k7G68nqPIigIOFnIVCD/yAWISkFO6c/NroAiAbkX7eg/mJAUOATw3v4VzjpzTWSJxDL502F4gE M8hNuUxnTEBt77oXJ9QO2gEpCW1mEsnnSSiDQ8PiXGjcPBamc6Ny1yqCXLljW3ybOzeBdhFsdzX afObt8+b4GtCy0G5e6ntJnUhKdApNXkVy4FWiUQwSLE5ko0g5vqiuFlhlvNC28fyPxxR+qp4WhL q3SMhsC7F58hngvZrVhmaudsLBjwzuun6FZKCBOUi9Oo494dEzyYv/ogkMRc3oYtXXIiUAJ4vb1 mIoH+pUmzJBWP/EUqNUzqAXAMCwEWvYTOnRQyfCbmczcGYxJJrR2lj8xZXGFpbOnRHhrn2jJhcZ t0nzkdD8a05VjCFCeNIBvdt9T2s5e38xLVq3RJGGl6P6hNjAYGn3N3Fk34fJh4x96ir8koBHtge 8+J5pRv4uC0MhxHEcYbr+wPNMN+PwY8b1zE3PzRWPIdnHn0NQiwiruA/AqELTEkkDoiey43lOiH WPjjqlrdt242VwA== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski QCA6390 can albo be used on non-DT systems so we must not make the power sequencing the only option. Check if the serdev device consumes an OF node. If so: honor the new contract as per the DT bindings. If not: fall back to the previous behavior by falling through to the existing default label. Fixes: 9a15ce685706 ("Bluetooth: qca: use the power sequencer for QCA6390") Reported-by: Wren Turkal Closes: https://lore.kernel.org/linux-bluetooth/27e6a6c5-fb63-4219-be0b-eefa2c116e06@penguintechs.org/ Signed-off-by: Bartosz Golaszewski Reviewed-by: Paul Menzel Tested-by: (...) --- drivers/bluetooth/hci_qca.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index a20dd5015346..2baed7d0f479 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -2412,11 +2412,14 @@ static int qca_serdev_probe(struct serdev_device *serdev) break; case QCA_QCA6390: - qcadev->bt_power->pwrseq = devm_pwrseq_get(&serdev->dev, - "bluetooth"); - if (IS_ERR(qcadev->bt_power->pwrseq)) - return PTR_ERR(qcadev->bt_power->pwrseq); - break; + if (dev_of_node(&serdev->dev)) { + qcadev->bt_power->pwrseq = devm_pwrseq_get(&serdev->dev, + "bluetooth"); + if (IS_ERR(qcadev->bt_power->pwrseq)) + return PTR_ERR(qcadev->bt_power->pwrseq); + break; + } + fallthrough; default: qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable", From patchwork Wed Jul 31 15:20:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 816128 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6EA01BC075 for ; Wed, 31 Jul 2024 15:21:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722439266; cv=none; b=a2InOHoJK2DeuNhr59YsJfZedFdUGtJrrUZyK7GWmD+hMQOTZ3MzwgaDXrE4YWkkZEUHSbFsE9ip3d5BqvLikwL/FssLuXzdtnXXVg3z9SIESsWZsIyC4J8AJHdS5gbS0N4brZrwf04pDoNxqbzCHmW0jdAPrSPP+WPd8mSG4I0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722439266; c=relaxed/simple; bh=LdpDzyWFCiBgonFQqFfm0nqC7qS83IeudAT7ZO0JOjI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BoqvkYNtPQSgNX6el70i/Y9uOjTItkNGBVh2+aew1nMKWRpS7UvQTuYTZ3zeXqcNkj5lpqh5KPgpvrBA2siEAI+5vlaohnSO8YSraFhu4UCy0ALOvTIoxS/RFankor0ki30pzt6Ed7jnRzxkN4P5tJBuTzdYPYWGZDD1azhUOcA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=sdnQHH+L; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="sdnQHH+L" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-428178fc07eso35403325e9.3 for ; Wed, 31 Jul 2024 08:21:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1722439263; x=1723044063; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FjqaRp206Si4rf5IzNwrt387VW4IpvIj/Qpte2KdXr0=; b=sdnQHH+LJ+r/AlJ9qJ2xrV/4Ng73OGMPcKN5LhalnqOYVr+Cr2icYHCvr85uoFDf0r Frw4gSLpjlZS586h7AnkYw6hGboUq4NwWhiUtgI5h2EOwfyf1FYk9PJQZCCGZBjPYm8f zzrV2dq7ICb2KY+ydMqn9sWqoTsfC3Ym5Zv27FYboTANTt1sSdvhcOG0hDnFoMiMzB+x fRRxSHXrGNRlMXtWYbejBUu9WO7CZdzhf3O0d+5kSKGlR5C2MaCJA3qynoC9Ijm/qcmB cpNg+QOzs7sdPc7/5pfGH7EsO75zsHo0ZIfuhWXAjL1XjANG/zniCDNDMCKJZoNJ2p4W M2Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722439263; x=1723044063; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FjqaRp206Si4rf5IzNwrt387VW4IpvIj/Qpte2KdXr0=; b=e6u/k7wxSJWJuLEZ6rOqI424CrbMAsDOCY4+RGKHInH5mIAGbT/xrnc7I81Xu4f2Tp O/aI/bBVjl+Xg65QpHizckvdPjFAOJ/UavLO7ZXDAH/8jOq65Yh3pEG9GeiigS0fj9G8 45KQ0v5j+HcLSDAvJRnIy+46s6KJ8DNwwR/rcTWY/JBw78PL9TDECIfbvqXBBBVI2lfm WFJLixFCnx+uVsS8O2mpyh8PFumNm8b2sqk6JPkaCDk/8aCrsJHcTLin3FpKvu+6ITO/ mELMFP8uB5GtK2BBJ+4jDSGlOzf32hiT0pHLAHyhbKtAJT2TFd/P6u9OMrgvNRoHxyIN qM3Q== X-Forwarded-Encrypted: i=1; AJvYcCWPciQdZdMojWpOQT5r1WIwLVWaCeJKxztjh4N6KsPiiis2sU5Ep01vMRZClYGo8S5lCIEwkreMcBQo2YkAp7/DrlNt7qGPGwrl/hpH2zbI X-Gm-Message-State: AOJu0YyBRI0WFDfHw5omVgzU11LhvLg+Rrooh8iQ8RjqKDCIMpU43FJG vlPZ/geAEhgCuGYsMW3NAJP8fCCf8Fk6EhWOwsSWnBfWgGVM+6O5z3PJVusVHns= X-Google-Smtp-Source: AGHT+IHcLguNI7OAQUaUZoauSdiiaQ/CGK++QofAFtMwzzBCR5KsjWfoSZGLptO1yR5v8Km8kyW5Fg== X-Received: by 2002:a05:600c:35d5:b0:428:abd:1df1 with SMTP id 5b1f17b1804b1-42811d89a32mr115041105e9.9.1722439263158; Wed, 31 Jul 2024 08:21:03 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:9c3f:3dd8:b524:cb31]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4282b8addd6sm24752925e9.20.2024.07.31.08.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 08:21:02 -0700 (PDT) From: Bartosz Golaszewski Date: Wed, 31 Jul 2024 17:20:50 +0200 Subject: [PATCH 3/3] Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240731-hci_qca_fixes-v1-3-59dad830b243@linaro.org> References: <20240731-hci_qca_fixes-v1-0-59dad830b243@linaro.org> In-Reply-To: <20240731-hci_qca_fixes-v1-0-59dad830b243@linaro.org> To: Marcel Holtmann , Luiz Augusto von Dentz , Wren Turkal , Dmitry Baryshkov Cc: Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1129; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=hI7Px+pNJ9VMgQcWvO9ows8sLOPoMdCRJ9COC7+Xuio=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBmqlZc87l17khxWQpatC649asQoOe28Ys7zbs8B qwDFRvSF4qJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCZqpWXAAKCRARpy6gFHHX coKpEACmnRP6OKNLCdGD7MsJ7G1OVWYfaAP2rmChgpX2vg8qFzhiPlkw10QRnSHApfQ8U6kmxbK /oCIf1/Z35nrJO62Qo3LURhLUhUwIMPYVKdPrSCKoP2w36lRMHdMbyPy2PuX6UM+gzztlniaCgN 3wytlDbziUnBiFdtWVJdLgrmhdf4rNMdl1h2r8kpMMIrrByRJSDo6hpwLtXnDesq/U2CZcdT4Z3 AoupXSnB6gkO+uvnCaQWYUNVAmGEnmXGyu0lY6iHyqq0+2bIPowsXgyDORQKwp43qZ3C3UZvrZg ydvsdTgZH3G2vmGyhZhN43ptadBArAHXJU7ISPAW5VEtXIsHDFw/A7hVtgteyAyCllJXxDJkSPG URnXnZgSgGPsWgpZlA0mjvHiHhTJBOBV760ivqglRWCzq9HLct40i8D0U6Soi8dDZI27Zdxi4Wz KfqzHts5MAJmifLQzdhejZBInNh7fSQVSsQG75fTUz3SEeGQ8Hmn1DjoD++dL9Af57qGUavxyxB IZ0MgKuJ7c4mT030Cr7XzEWVxD/STKyJ2IlYM0qubufIG5fvgsmbLW1e1r61wuhZkj6fk0ixjiY UAGYRkaujYpX8IVtDeHEw/dJml8uIUOvRXh2JOW/9h9QA3dCF9P2ImVR8g9XRqfyXaHWnrhBExr EenmdSKLFItAhHQ== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski Unlike qca_regulator_init(), qca_power_shutdown() may be called for QCA_ROME which does not have qcadev->bt_power assigned. Add a NULL-pointer check before dereferencing the struct qca_power pointer. Fixes: eba1718717b0 ("Bluetooth: hci_qca: make pwrseq calls the default if available") Reported-by: Dmitry Baryshkov Closes: https://lore.kernel.org/linux-bluetooth/su3wp6s44hrxf4ijvsdfzbvv4unu4ycb7kkvwbx6ltdafkldir@4g7ydqm2ap5j/ Signed-off-by: Bartosz Golaszewski --- drivers/bluetooth/hci_qca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 2baed7d0f479..45adc1560d94 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -2160,7 +2160,7 @@ static void qca_power_shutdown(struct hci_uart *hu) qcadev = serdev_device_get_drvdata(hu->serdev); power = qcadev->bt_power; - if (power->pwrseq) { + if (power && power->pwrseq) { pwrseq_power_off(power->pwrseq); set_bit(QCA_BT_OFF, &qca->flags); return;