From mboxrd@z Thu Jan 1 00:00:00 1970 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 06D80EE14A9 for ; Thu, 7 Sep 2023 01:32:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240245AbjIGBcP (ORCPT ); Wed, 6 Sep 2023 21:32:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229902AbjIGBcO (ORCPT ); Wed, 6 Sep 2023 21:32:14 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33103199A for ; Wed, 6 Sep 2023 18:32:10 -0700 (PDT) Received: from dggpemm500008.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rh1q32DDyzMlBL; Thu, 7 Sep 2023 09:28:47 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500008.china.huawei.com (7.185.36.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 7 Sep 2023 09:32:07 +0800 Received: from [10.174.178.174] (10.174.178.174) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 7 Sep 2023 09:32:06 +0800 Subject: Re: [PATCH] mcb: fix error handling for different scenarios when parsing To: =?UTF-8?B?U2FuanXDoW4gR2FyY8OtYSwgSm9yZ2U=?= , "jirislaby@kernel.org" CC: "morbidrsa@gmail.com" , "linux-kernel@vger.kernel.org" , "jth@kernel.org" , =?UTF-8?Q?Rodr=c3=adguez_Barbarin=2c_Jos=c3=a9_Javier?= References: <20230906143605.1877335-1-jorge.sanjuangarcia@duagon.com> From: Yang Yingliang Message-ID: <8e8d98a0-9111-86e5-38e5-bfa4beb6d1ba@huawei.com> Date: Thu, 7 Sep 2023 09:31:31 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20230906143605.1877335-1-jorge.sanjuangarcia@duagon.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.174.178.174] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/9/6 22:36, Sanjuán García, Jorge wrote: > chameleon_parse_gdd() may fail for different reasons and end up > in the err tag. Make sure we at least make sure we always free > the mcb_device allocated with mcb_alloc_dev(). > > If mcb_device_register() fails, make sure to give up the reference > in the same place the device was added. > > Fixes: 728ac3389296 ("mcb: mcb-parse: fix error handing in chameleon_parse_gdd()") > Reviewed-by: Jose Javier Rodriguez Barbarin > Signed-off-by: Jorge Sanjuan Garcia Reviewed-by: Yang Yingliang