Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3027429rwb; Mon, 15 Aug 2022 16:25:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR6VGvLRs+F7OAccLO5WzF1GRHOEvn+S5scQ3DOHxpbjA+aHt4auQFIAZG8CRoGrn9gNXJ3I X-Received: by 2002:a17:902:be16:b0:170:8ebf:204c with SMTP id r22-20020a170902be1600b001708ebf204cmr19857789pls.47.1660605946810; Mon, 15 Aug 2022 16:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605946; cv=none; d=google.com; s=arc-20160816; b=z4Q3F4eGlf5ymvfN1Bz8knSwahnuEkJGWT+428K5toifyj3NHFoMTwi78IzyyrCgWF SwAPV0E1dtDfxFqxwDmE30XAec5IVVmKipxSRsuQk7gnRUomE7X4JUvpzPI6R7Laagez 7f37yxjPPQfTvB0EfXsy5Rn7P3o8/Y6K/Mq1dMh4yGEZQA4SF6BSUJNOtgiWD0yf6OQj ZNQoQxRn2GhR61mk7e253DHtL8lEpzkisdGxiidz7Xa7PxAojrUY0v9sAxubGSTA6GcB X5wQ+eCvsJb6j3u4PNTndMC01II65tUkuRgR77kbSL5Htnc5gNsNkeyvFpy+/hqQTXN/ YZ/g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p5AE1pP8/iaq8GOM5BR4P1+MnjFnSFZwlHYJGgZAQN8=; b=EI/xO3VxHA9+KizCOQFN8QMC252KeHNYnQFFO9R6/Pho5cNtABVX6WCRhI0M3BSmIh TLcB93d0BT70qrRV7xqlGtU0ZzqDl2+bk6B9LXL45xSpJWUqCv/LaOrCHBv3fQAf1J82 GWkoTVZNWwBojdkoC++ltdbJWLD6uamXSvC98s4AwIWqrN1OHx1nzsA+ZJGGlZzvzoSK XDG2myVwmVCkAPwhEzh8Z7+EFbg2FDf909s1GqjT9Xz9PPY/FozVhyxarHI47O0ttnpF MiPbrSABsf1uEJf89DLmigptYHyE0NIKcdxzBFXpnx/Yq+Fx3+POzkd47qjt9bV0ogcZ g8NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r9j8aEMA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s6-20020a170902a50600b0016dcacb565csi10621376plq.596.2022.08.15.16.25.35; Mon, 15 Aug 2022 16:25:46 -0700 (PDT) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r9j8aEMA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352301AbiHOWzG (ORCPT + 99 others); Mon, 15 Aug 2022 18:55:06 -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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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_device *pdev) uartclk = clk_get_rate(data->clk); if (!uartclk) { ret = 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; + } } /* the HW-clock divider for bcm2835aux is 8, -- 2.35.1