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 907FB611B for ; Sun, 28 May 2023 19:38:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20D91C433EF; Sun, 28 May 2023 19:37:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1685302680; bh=CN6hZSzgv0WiBfJt8u2VvNa8CIIw1TygZd8sgF36PMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J71+ml90c4FpJYc4GL3896DLezbbnA8xLkSpAOaXV+hbpbC3U3KWxCvxMUpqZKuZF A9A0uyGO5X8qx9VAdz/LkGUQpUpeFsZvslkUzuIWdx7ZPPpC7qrjsvHh4DYfsZI3/A ztbzl3LqTj9jcxUgOtLECBljn14u2WorUPxXFqic= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kang Chen , Sebastian Reichel Subject: [PATCH 6.1 074/119] power: supply: mt6360: add a check of devm_work_autocancel in mt6360_charger_probe Date: Sun, 28 May 2023 20:11:14 +0100 Message-Id: <20230528190837.978555095@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230528190835.386670951@linuxfoundation.org> References: <20230528190835.386670951@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Kang Chen commit 4cbb0d358883a27e432714b5256f0362946f5e25 upstream. devm_work_autocancel may fail, add a check and return early. Fixes: 0402e8ebb8b86 ("power: supply: mt6360_charger: add MT6360 charger support") Signed-off-by: Kang Chen Signed-off-by: Sebastian Reichel Signed-off-by: Greg Kroah-Hartman --- drivers/power/supply/mt6360_charger.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/power/supply/mt6360_charger.c +++ b/drivers/power/supply/mt6360_charger.c @@ -799,7 +799,9 @@ static int mt6360_charger_probe(struct p mci->vinovp = 6500000; mutex_init(&mci->chgdet_lock); platform_set_drvdata(pdev, mci); - devm_work_autocancel(&pdev->dev, &mci->chrdet_work, mt6360_chrdet_work); + ret = devm_work_autocancel(&pdev->dev, &mci->chrdet_work, mt6360_chrdet_work); + if (ret) + return dev_err_probe(&pdev->dev, ret, "Failed to set delayed work\n"); ret = device_property_read_u32(&pdev->dev, "richtek,vinovp-microvolt", &mci->vinovp); if (ret)