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 F0E451AB6F1; Tue, 30 Sep 2025 14:56:43 +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=1759244204; cv=none; b=Occ0MiI9c2m1mKzRepUCpP/8p+reX93yf9Vio+I7vrMUY2sEnf+y8r15o4sBAo3zzxhGiu6X/tSTSfFivEFNYz10cjS1Mn7AwKs2uwO/IroaaDvsjQTPce/A4YqNJh+w1T8EfcIX1iKoh5pj3dFDA5JinIJun8r+tyRazA0sjEc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759244204; c=relaxed/simple; bh=oqb9j9MTszV+YZEnJEPE61Dzih81qRflc/I7SWLhbTc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u1s/Ag+Te+Vl8MzcqslfWBKQs7RWztHiMWtPOtyVP6cXCsU/Nqhk/YL9bQtayWb1LVjLcvPL1HJYpI+StRFnReZZrpuht8Qn7dY2nhiiKlv/zP14Q79/O+tgT3BSacOoHugWai/tMYUi7rX7/JcC0MoGaJ3+g065aCRJocGEUQo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nTI36js4; 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="nTI36js4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A65FC4CEF0; Tue, 30 Sep 2025 14:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1759244203; bh=oqb9j9MTszV+YZEnJEPE61Dzih81qRflc/I7SWLhbTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nTI36js4RfSPV4OgWgR6a1qX5IwChburmzzvvoeK7VpytL5G+ldGlDQBVrhOmi3OD IVvqOKILejqSwHjalvKQk18rdoU0n/aw4gjozdlaXSqQq89Gf++Mky/HwWybOtouA+ Bn740UVxDLazvu4IVNZxudTQSQiiUDws5Dknxq84= 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 5.10 059/122] power: supply: bq27xxx: fix error return in case of no bq27000 hdq battery Date: Tue, 30 Sep 2025 16:46:30 +0200 Message-ID: <20250930143825.413027043@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250930143822.939301999@linuxfoundation.org> References: <20250930143822.939301999@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-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 @@ -1829,7 +1829,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.temperature = bq27xxx_battery_read_temperature(di); if (di->regs[BQ27XXX_REG_TTE] != INVALID_REG_ADDR)