Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1177730rwr; Thu, 27 Apr 2023 13:35:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5kmlmJ/poDh1fTXPgSQxKBbvXz+s1tSALtRtBUu16x79IGig1tlDh+M/o9WUuV4UgLWHUx X-Received: by 2002:aa7:88d0:0:b0:63a:5bcd:e580 with SMTP id k16-20020aa788d0000000b0063a5bcde580mr4473907pff.9.1682627748900; Thu, 27 Apr 2023 13:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682627748; cv=none; d=google.com; s=arc-20160816; b=hx3jNN8UAUGDgTv7qlVLEn7jz2JQUOZw3ujQFwaab6dWHPg8/QHjOR6NE96pUC2M7M uBAH0eW+3+tvzIC8NLiXjYePzFbOzf5aySeKy6jveMXbWtGAcYzjcW2wLuISv/7fnqY4 8/aQNshtNtg5+kTNx9YQC3StkCt6UhBRScJhyjEMAvlKXlpY1l2/dBJpBsrfOJa9CA2D MB9ZbNobnmJlgMRrPBSm4n8qAYAegxAhzI/lO6wVtQtmSlaXGXqlPiJmuBEfGOfmrnnG E/qZ78JZ3KbVwxA8sDenQ1F09JZRvShxjjERnXzs1pZldrlV5tAvY4jheCmuwIso51jM yVuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=1rsbZtenHmrnqF4Ffk+H2ILDLPPocKXAqSr9a8KsmVQ=; b=N3v7AUISdyRgB1NkCf65mmBIcWLQM/UcJL6VG4tywii0cSL2CETiLufseGfR0YvnEk tqiiGm5ssRvKyqXefXmPp9ej0F0TKKtKSrmZ1R7Ex4b4hJvr3Il9UxMQ9Ijr16oBAkpe LaA4LEh8M+qyRL1fZW/xF/BjdK4nuuRRImdioiA7YBjhIiLM4U1XHttpZetEtyfqLoLE OVmBzpRS0Dz+I/YNnaKhFSaR3DFSE9c7nITc/0s97vMih1zWa6mG6FMsr1eECN3kt6s/ Vk4bk5WABqBmDb0qxIzFAz0SkDvItzs9gf7JktdPrybEISFiGKw5nwvunMF9ThVzXHmz cEGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=YfPbKyrO; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w126-20020a626284000000b006375460490dsi19347048pfb.136.2023.04.27.13.35.34; Thu, 27 Apr 2023 13:35:48 -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=@wanadoo.fr header.s=t20230301 header.b=YfPbKyrO; 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 S229824AbjD0U3k (ORCPT + 99 others); Thu, 27 Apr 2023 16:29:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344204AbjD0U3j (ORCPT ); Thu, 27 Apr 2023 16:29:39 -0400 Received: from smtp.smtpout.orange.fr (smtp-16.smtpout.orange.fr [80.12.242.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 885644236 for ; Thu, 27 Apr 2023 13:29:38 -0700 (PDT) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id s8FCpJCcq9Qtjs8FCpvUK5; Thu, 27 Apr 2023 22:29:36 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1682627376; bh=1rsbZtenHmrnqF4Ffk+H2ILDLPPocKXAqSr9a8KsmVQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=YfPbKyrO2pe5kB/c6GCh9r1DveBEBvc6MPrDkGfciG/EuieQ+ED+Kzem0wR5xNxFJ 4APp/yRWPBksSycpJWsgCUcMaM372gtwgbWI67LkOrZcqmfprB47wPczQ8e6WkkWSX yZJ70o6I/+MSgSA3pAL9PW7tuVnd3b6/Cs4tyNzkVnVteP5e5ZjmN4P3U7S7cGoWG5 pGB4RXCg1u/fmkoaVCfpGM2BDT+A+y1MIyM3W28ehz/bunV2F5/I6/xRmj+wR04aPb PKM6iaYzXPCXBRuUG7aXj88OwZmzeuk4KFckHLyi3UwQ706+0WreLNEHihFPm8h8cp sZXwq7gvpZskQ== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 27 Apr 2023 22:29:36 +0200 X-ME-IP: 86.243.2.178 Message-ID: <37c23054-1590-b33d-9299-7d5d6198f8f0@wanadoo.fr> Date: Thu, 27 Apr 2023 22:29:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH 2/2] serial: 8250_bcm7271: fix leak in `brcmuart_probe` To: Doug Berger Cc: Al Cooper , XuDong Liu , Dongliang Mu , Jiri Slaby , Florian Fainelli , Broadcom internal kernel review list , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman References: <20230427181916.2983697-1-opendmb@gmail.com> <20230427181916.2983697-3-opendmb@gmail.com> Content-Language: fr, en-GB From: Christophe JAILLET In-Reply-To: <20230427181916.2983697-3-opendmb@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Le 27/04/2023 à 20:19, Doug Berger a écrit : > Smatch reports: > drivers/tty/serial/8250/8250_bcm7271.c:1120 brcmuart_probe() warn: > 'baud_mux_clk' from clk_prepare_enable() not released on lines: 1032. > > The issue is fixed by using a managed clock. > > Fixes: 41a469482de2 ("serial: 8250: Add new 8250-core based Broadcom STB driver") > Reported-by: XuDong Liu > Link: https://lore.kernel.org/lkml/20230424125100.4783-1-m202071377@hust.edu.cn/ > Signed-off-by: Doug Berger > --- > drivers/tty/serial/8250/8250_bcm7271.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c > index 90ee7bc12f77..af0e1c070187 100644 > --- a/drivers/tty/serial/8250/8250_bcm7271.c > +++ b/drivers/tty/serial/8250/8250_bcm7271.c > @@ -1012,7 +1012,7 @@ static int brcmuart_probe(struct platform_device *pdev) > of_property_read_u32(np, "clock-frequency", &clk_rate); > > /* See if a Baud clock has been specified */ > - baud_mux_clk = of_clk_get_by_name(np, "sw_baud"); > + baud_mux_clk = devm_clk_get(dev, "sw_baud"); If switching to devm_clk_get(), maybe devm_clk_get_enabled() could also be an option to fix both issues and avoid adding some LoC. The order of operation in the remove function would then be different. I don't know if it can be an issue. Just my 2c. CJ > if (IS_ERR(baud_mux_clk)) { > if (PTR_ERR(baud_mux_clk) == -EPROBE_DEFER) { > ret = -EPROBE_DEFER;