Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2647573rwb; Mon, 19 Sep 2022 08:02:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5FWypsZRjDm32dxQvUenI1x8K3KARBgpU1Ff2lkEamrEaCx7s2vIW6BJIqhx39heNJvmD9 X-Received: by 2002:a17:907:a04f:b0:772:da0b:e2f1 with SMTP id gz15-20020a170907a04f00b00772da0be2f1mr13028284ejc.327.1663599754232; Mon, 19 Sep 2022 08:02:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663599754; cv=none; d=google.com; s=arc-20160816; b=pIbUhRSH/Wgpb64Kg7L1me9IVbvEfodrAzYKRhRy+JfSxRIAuS0M8B2v57sgl1P0mM xK0pojLmrkTgwpGJXofEdBVaWwUDWsFhED6uI74g8oDw0yMVsf4rCJL35++aplNyY696 U3PHrTy3XY5Wdt3FB4YqN/XF0eKdHpsmtpwJrr5BvbTdinrQiVRz1HVlukQ2seG3HqNO FI/AOrJQqhcan+H1HkOQBEikAwZiFsMuGOCt1Y50jk+ucZMqRilabq8ViQHH0IbRc0QJ D2ydl09tMLxv9oqZItY8192+kLhyOibvL3aKLjV15rYFGyl+kibK29L8qTjUML1ZjaQw PSnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=BrOmYM94iLD8xbIFDe9dxekAi+ny0YPejaxmJzksm5I=; b=ubjfw382lroJVLzVC26s0Xf28LAbn2rChod9mnhaXZFB5bUNq3T/38wpITMQvt3aar BzGYb7WtXuas3+Wr+m5PF3ppCIVs9+OTZT6PQfr3iyw+GnOFVj/QehJAerHeoTvbec+N OgIyzdBHC0fcTyx+YNfVnD+jGa4FmSaiW/DO/Gsal4vfI+yvRIgoX9O080bQzmARERNL KICg6/lRhg3dFD0i2XM1vxS02RuQS+Taw4ovtDajg18Z40qNX6KO9KaaRlvSYxzOKl8w XKNrKXKLz75bG5lfwJq8/Cj/5SCQ0N6XIOvvaZNr2Si8WUXJOcandgGY+nihIj/esRBE iwVw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ek10-20020a056402370a00b004536683aa45si7536327edb.303.2022.09.19.08.01.57; Mon, 19 Sep 2022 08:02:34 -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; 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 S229871AbiISOvK (ORCPT + 99 others); Mon, 19 Sep 2022 10:51:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbiISOvI (ORCPT ); Mon, 19 Sep 2022 10:51:08 -0400 Received: from elvis.franken.de (elvis.franken.de [193.175.24.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D576132EFB; Mon, 19 Sep 2022 07:51:03 -0700 (PDT) Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1oaI6u-0005ft-03; Mon, 19 Sep 2022 16:51:00 +0200 Received: by alpha.franken.de (Postfix, from userid 1000) id 41D40C12F2; Mon, 19 Sep 2022 16:48:31 +0200 (CEST) Date: Mon, 19 Sep 2022 16:48:31 +0200 From: Thomas Bogendoerfer To: Lin Yujun Cc: christophe.jaillet@wanadoo.fr, paulburton@kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next] MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create() Message-ID: <20220919144831.GC7674@alpha.franken.de> References: <20220914032917.97203-1-linyujun809@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220914032917.97203-1-linyujun809@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE 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 On Wed, Sep 14, 2022 at 11:29:17AM +0800, Lin Yujun wrote: > In error case in bridge_platform_create after calling > platform_device_add()/platform_device_add_data()/ > platform_device_add_resources(), release the failed > 'pdev' or it will be leak, call platform_device_put() > to fix this problem. > > Besides, 'pdev' is divided into 'pdev_wd' and 'pdev_bd', > use platform_device_unregister() to release sgi_w1 > resources when xtalk-bridge registration fails. > > Fixes: 5dc76a96e95a ("MIPS: PCI: use information from 1-wire PROM for IOC3 detection") > Signed-off-by: Lin Yujun > --- > arch/mips/sgi-ip27/ip27-xtalk.c | 70 +++++++++++++++++++++++---------- > 1 file changed, 50 insertions(+), 20 deletions(-) applied to mips-next. Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]