From nobody Fri Oct 24 20:35:21 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78A0EC00140 for ; Mon, 15 Aug 2022 22:55:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352208AbiHOWzL (ORCPT ); Mon, 15 Aug 2022 18:55:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352162AbiHOWxI (ORCPT ); Mon, 15 Aug 2022 18:53:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C14DA7F10C; Mon, 15 Aug 2022 12:54:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3FB42B81144; Mon, 15 Aug 2022 19:54:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F727C433D7; Mon, 15 Aug 2022 19:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593281; bh=keQl0RqzTCXOjfuUaTm3QR3v50m15zFuKa0dQ4j6y1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r9j8aEMAR5LCQNrfKbKnfoxyq4Pr/HIs4z3RsrOY9R254XN24jgH0kwHarp95xnaJ 7pt3d3USjMx1e6TtU9cl7DYzrUX+rsDiFRPdHR9FVdnFT16M52a00Pt7jDdoVS5L6y Jlc1xTW1Xm2PiNFXBLOIEk32c5yLPdlhVPERj9os= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Florian Fainelli , Guo Mengqi , Sasha Levin Subject: [PATCH 5.18 0922/1095] serial: 8250_bcm2835aux: Add missing clk_disable_unprepare() Date: Mon, 15 Aug 2022 20:05:21 +0200 Message-Id: <20220815180507.406769177@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guo Mengqi [ Upstream commit b9f1736e475dba0d6da48fdcb831248ab1597886 ] The error path when get clock frequency fails in bcm2835aux_serial driver does not correctly disable the clock. This flaw was found using a static analysis tool "Hulk Robot", which reported the following warning when analyzing linux-next/master: drivers/tty/serial/8250/8250_bcm2835aux.c: warning: clk_disable_unprepare_missing.cocci The cocci script checks for the existence of clk_disable_unprepare() paired with clk_prepare_enable(). Add the missing clk_disable_unprepare() to the error path. Fixes: fcc446c8aa63 ("serial: 8250_bcm2835aux: Add ACPI support") Reported-by: Hulk Robot Reviewed-by: Florian Fainelli Signed-off-by: Guo Mengqi Link: https://lore.kernel.org/r/20220715023312.37808-1-guomengqi3@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_bcm2835aux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial= /8250/8250_bcm2835aux.c index 2a1226a78a0c..21939bb44613 100644 --- a/drivers/tty/serial/8250/8250_bcm2835aux.c +++ b/drivers/tty/serial/8250/8250_bcm2835aux.c @@ -166,8 +166,10 @@ static int bcm2835aux_serial_probe(struct platform_dev= ice *pdev) uartclk =3D clk_get_rate(data->clk); if (!uartclk) { ret =3D device_property_read_u32(&pdev->dev, "clock-frequency", &uartclk= ); - if (ret) - return dev_err_probe(&pdev->dev, ret, "could not get clk rate\n"); + if (ret) { + dev_err_probe(&pdev->dev, ret, "could not get clk rate\n"); + goto dis_clk; + } } =20 /* the HW-clock divider for bcm2835aux is 8, --=20 2.35.1