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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3D82C47082 for ; Tue, 8 Jun 2021 23:21:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80BFB61184 for ; Tue, 8 Jun 2021 23:21:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235463AbhFHXW6 (ORCPT ); Tue, 8 Jun 2021 19:22:58 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:34623 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235431AbhFHXW4 (ORCPT ); Tue, 8 Jun 2021 19:22:56 -0400 Received: (Authenticated sender: alexandre.belloni@bootlin.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 1341D1BF204; Tue, 8 Jun 2021 23:21:00 +0000 (UTC) Date: Wed, 9 Jun 2021 01:21:00 +0200 From: Alexandre Belloni To: Parshuram Raju Thombare Cc: Nicolas Pitre , "slongerbeam@gmail.com" , "vitor.soares@synopsys.com" , "praneeth@ti.com" , Milind Parab , "linux-i3c@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v10 2/7] i3c: master: use i3c_master_register only for main master Message-ID: References: <1606716983-3645-1-git-send-email-pthombar@cadence.com> <1606717066-3785-1-git-send-email-pthombar@cadence.com> <2s3n7419-1nr9-8885-882o-7qrsos6qq6q@syhkavp.arg> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/12/2020 05:47:51+0000, Parshuram Raju Thombare wrote: > >This looks a bit confusing. Here you're rolling back detailss in > >i3c_primary_master_register() that were factored out in > >i3c_master_init(). If i3c_master_init() is successful, then you > >shouldn't be undoing its things openly in i3c_primary_master_register(). > >Instead, there should be another function that does the reverse of > >i3c_master_init() here. > > Every function do its cleanup in case of failures. > And if any failure occur after successful i3c_master_init(), we have > function i3c_master_bus_cleanup() which does the major cleanup. > The point from Nicolas here was that the workqueue is allocated in i3c_master_init so you should have a function to destroy it instead of having to do that separately in i3c_primary_master_register. The same is true for the put_device. Or you have to ensure i3c_masterdev_release is called when i3c_primary_master_register fails. -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com