From patchwork Wed Feb 15 12:43:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 57521 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp171478wrn; Wed, 15 Feb 2023 04:51:59 -0800 (PST) X-Google-Smtp-Source: AK7set9btBcaSeYVv109qvtHA5I9LhHMqpOgimjacuakCdVYL0b/m4d0d/iXEkAXZDuccltNBXtj X-Received: by 2002:aa7:d3cc:0:b0:4ac:bdf3:36ca with SMTP id o12-20020aa7d3cc000000b004acbdf336camr1805239edr.10.1676465518919; Wed, 15 Feb 2023 04:51:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676465518; cv=none; d=google.com; s=arc-20160816; b=pwyNx1qd/H+zISZyXI4hYrhDbQBdJrDPc9LTdfempqovgixS4WzraiVW4d5aL9DjcK BbHamn1ZYm9sn3ILrygyTEkf+BdM64DGhWAUtTQugFSjatKI5fVC+FQlKlxkuNVxrH7q kMXy+iBLyXPzMLoWt7xKgzZ6bcU3iOJ8Zf6eLq5HOF6okIqZXJEZm/unveMHF/zBCjR3 W4s6D1RIWXQUd/v1am0asRNnOOeDE8Lpzh1nOsi+ceYTeBfB3jlyRMj4NoMGdTRGO0Bg 8Gi2Tf7S6NymgSqJqJC9dllGZ5wI1bbrdik9wXRWAqsNglCY153/N9d8B/WiGr768mUL kTdg== 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 :message-id:date:subject:cc:to:from; bh=VWC0ebPyVVY0sBWa7gEFVdtug5XxfmZzb8R6J8BVHHA=; b=FaHKID757/yg+vHcAiIibbu7pxVlxhpbgSOVJJLOcNXaACm8/fRtoLfY+muecgh04T IV+uT3mSTj1v7sVurPQUmJ1Z/11PZfjHPi4E4eYILVUZNI5JmYsksAwMjwaF6fY1a1cN Bj/aLBn9tbob1qb1WZww0gM8dy4DjOAeVwWWbFRWXJv/M9nISDAiBKphO0SzNG4jiWvP /mqeWQzUXgAtUoS/ZKc15seW2EWluM13uA7mWc2FOBePI0J9iQZKY2C54fCUf4RF4tVI F6ingNyp0eWTCaPaMo+YIy4SWR2xp0pvTv+R4XCiu0nxzdptdvijaZi1u93ZNioEXjow rNbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020aa7ccc4000000b004ad08ed6815si1482097edt.403.2023.02.15.04.51.36; Wed, 15 Feb 2023 04:51:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234073AbjBOMnP (ORCPT + 99 others); Wed, 15 Feb 2023 07:43:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233894AbjBOMnM (ORCPT ); Wed, 15 Feb 2023 07:43:12 -0500 Received: from smtp.smtpout.orange.fr (smtp-20.smtpout.orange.fr [80.12.242.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7D7036695 for ; Wed, 15 Feb 2023 04:43:10 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id SH7ppsWwIZBE3SH7ppDdAf; Wed, 15 Feb 2023 13:43:08 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Wed, 15 Feb 2023 13:43:08 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Sebastian Reichel , ChiYuan Huang , ChiaEn Wu Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , Sebastian Reichel , linux-pm@vger.kernel.org Subject: [PATCH] power: supply: rt9467: Fix rt9467_run_aicl() Date: Wed, 15 Feb 2023 13:43:04 +0100 Message-Id: <2ed01020fa8a135c36dbaa871095ded47d926507.1676464968.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757901507937811547?= X-GMAIL-MSGID: =?utf-8?q?1757901507937811547?= It is spurious to bail-out on a wait_for_completion_timeout() call that does NOT timeout. Reverse the logic to return -ETIMEDOUT instead, in case of tiemout. Fixes: 6f7f70e3a8dd ("power: supply: rt9467: Add Richtek RT9467 charger driver") Signed-off-by: Christophe JAILLET Reviewed-by: ChiYuan Huang --- Compile tested only. This is spurious, because if I'm right, it means that it does not work! Testing on a real hardware is really welcomed. --- drivers/power/supply/rt9467-charger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/rt9467-charger.c b/drivers/power/supply/rt9467-charger.c index 96ad0d7d3af4..bb737fd1cca6 100644 --- a/drivers/power/supply/rt9467-charger.c +++ b/drivers/power/supply/rt9467-charger.c @@ -598,8 +598,8 @@ static int rt9467_run_aicl(struct rt9467_chg_data *data) reinit_completion(&data->aicl_done); ret = wait_for_completion_timeout(&data->aicl_done, msecs_to_jiffies(3500)); - if (ret) - return ret; + if (ret == 0) + return -ETIMEDOUT; ret = rt9467_get_value_from_ranges(data, F_IAICR, RT9467_RANGE_IAICR, &aicr_get); if (ret) {