From mboxrd@z Thu Jan 1 00:00:00 1970 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 55DA627B320; Mon, 22 Sep 2025 19:38:34 +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=1758569914; cv=none; b=YZzBSy0OqnEa7/pVbb1ItyGJe0noqHG8g/pATqPZvMoT3cfHn5pbEXp9JZQl/iA88OuhXtW1IIdIMUjPHfmk73yAom38b85I5U58HKc26de1K7Rvdscl3yNomIbDxrh8Bs8Ft9xprmZPsQSKXUlK9YdIn2C3mB923CGwnsPsquI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758569914; c=relaxed/simple; bh=fGY274266P41hyO6Y4g/Glr0TDS9XtTaA72xmUiCyW8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nCuLJMxhXR3T53KToLgaZNqfFYv3mZ6sC7iL1cokB0Bnk7yeo31p1QQhgRsppd3U6hB/3z1dA7vlH2uXbPZ9s7f0YgzOhoQOkIPPGVAhTgY7b+VEJBF9NTQUJGtjsdMbTteib2HdsTdc6Ph4yFjw1DoDugV4J9OkAgyT6BFjFCA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=jOWRmOFT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="jOWRmOFT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1E30C4CEF0; Mon, 22 Sep 2025 19:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1758569914; bh=fGY274266P41hyO6Y4g/Glr0TDS9XtTaA72xmUiCyW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jOWRmOFTO+jMj8zYR3gpKLqHaLbO5WVS6fkjt4dZVtTtyBohD/cE+cQub9QhqB8RP rmSE1WTeqyQgjyzhI4tONLkmTNH7hrY2zCVEOMF2JrAUrt3pcm0FI7w3lJknFJmKxl TT69BoNux8flXOclSACF2KrUE/Cfmkz3/Wpk6DSY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jerry Lv , "H. Nikolaus Schaller" , Sebastian Reichel Subject: [PATCH 6.12 038/105] power: supply: bq27xxx: fix error return in case of no bq27000 hdq battery Date: Mon, 22 Sep 2025 21:29:21 +0200 Message-ID: <20250922192409.914043808@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250922192408.913556629@linuxfoundation.org> References: <20250922192408.913556629@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: H. Nikolaus Schaller commit 2c334d038466ac509468fbe06905a32d202117db upstream. Since commit commit f16d9fb6cf03 ("power: supply: bq27xxx: Retrieve again when busy") the console log of some devices with hdq enabled but no bq27000 battery (like e.g. the Pandaboard) is flooded with messages like: [ 34.247833] power_supply bq27000-battery: driver failed to report 'status' property: -1 as soon as user-space is finding a /sys entry and trying to read the "status" property. It turns out that the offending commit changes the logic to now return the value of cache.flags if it is <0. This is likely under the assumption that it is an error number. In normal errors from bq27xxx_read() this is indeed the case. But there is special code to detect if no bq27000 is installed or accessible through hdq/1wire and wants to report this. In that case, the cache.flags are set historically by commit 3dd843e1c26a ("bq27000: report missing device better.") to constant -1 which did make reading properties return -ENODEV. So everything appeared to be fine before the return value was passed upwards. Now the -1 is returned as -EPERM instead of -ENODEV, triggering the error condition in power_supply_format_property() which then floods the console log. So we change the detection of missing bq27000 battery to simply set cache.flags = -ENODEV instead of -1. Fixes: f16d9fb6cf03 ("power: supply: bq27xxx: Retrieve again when busy") Cc: Jerry Lv Cc: stable@vger.kernel.org Signed-off-by: H. Nikolaus Schaller Link: https://lore.kernel.org/r/692f79eb6fd541adb397038ea6e750d4de2deddf.1755945297.git.hns@goldelico.com Signed-off-by: Sebastian Reichel Signed-off-by: Greg Kroah-Hartman --- drivers/power/supply/bq27xxx_battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -1910,7 +1910,7 @@ static void bq27xxx_battery_update_unloc cache.flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, has_singe_flag); if ((cache.flags & 0xff) == 0xff) - cache.flags = -1; /* read error */ + cache.flags = -ENODEV; /* read error */ if (cache.flags >= 0) { cache.capacity = bq27xxx_battery_read_soc(di);