Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4507217pxj; Tue, 8 Jun 2021 16:24:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLhmU3to4KvLV7GlQpLjE0ZzGwTg2XdIhE2+UTL6U8LSb5KAOHj+SSFWT5zeBbWfJauhC7 X-Received: by 2002:a17:906:4e06:: with SMTP id z6mr26640899eju.34.1623194694509; Tue, 08 Jun 2021 16:24:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623194694; cv=none; d=google.com; s=arc-20160816; b=MRGqgjOZ+dJLCvyfbxxMINt6eITiJ9vumaElQElGJ3fKlIBJDNVOIszmYr2w7WDLRF rGGlERk6lO7DQvUuw9Jiqxrqy05mNIJKKQe5x4LUOELmcfAO1BoaA4xVtE+ZWzIDrofC oU3Dt5z3Q/imHtffXQYtUFgdcYj33/5U8oEyBLUvZ1t1M146WkKdOEN5PI8BewbD5ggf nSacIUo8HqdMKGGB0vR+t3wHJt9WbMyULuA5sSl3ZN0Ey56t3/WcQhlBa6hULJPpAmYq glzriZiF+M5lrVhOOSydD11NvyD2egZxqaEJyZEsAuiiQ9oesO/R9U5DU9Lja+6hus69 H/sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=tbyAG1lz6QxkczxtGOusrznU53pCs6yEGxsTGfvgfqQ=; b=qYlpkF6GNyRPY/iJs/+jTyuWX8KQQKTwjrFxg+k7S6uMRkr3ij40O3GGz/2ex+9+oJ PDOYeMkzteSujGt6EqdmqgHS3t0FBd9RXLbEmGY22zAw9XFIccOcdjanCwrgVVbtr9KV XyVs9VdX3iYXW5uXGpKnfozK7wn5tF+5k9S98R953MP3SrH46WfuSDFiL17xuRCiTcfU fAZ3/BJmJv1zcI/hC39qxzH5URIDTSydSKGUTjJY5Xx5Vv3E6ay2KzWN0wv3khmSXryl 1RTiLSv7EBTM1tfhnUhgdj5yAedPQyZqqFf7b89c6VpbUryhC7au6PE5eguUwvDsZq66 KmQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p2si858719edx.131.2021.06.08.16.24.30; Tue, 08 Jun 2021 16:24:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235458AbhFHXW5 (ORCPT + 99 others); Tue, 8 Jun 2021 19:22:57 -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