Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp282759pxf; Wed, 10 Mar 2021 06:24:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMSa8Df0Wf3O7JEtSZ8+Wi7t0I5r/4Uh7L+5ZsrmGwYgg0O/VMc2T7QTrevDqYhet4vahc X-Received: by 2002:a05:6402:3596:: with SMTP id y22mr3562013edc.207.1615386271092; Wed, 10 Mar 2021 06:24:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615386271; cv=none; d=google.com; s=arc-20160816; b=0Z6BLxpAy7Idy+tn+xgmRGZ4L9S/JGkeQxkT9da72F7sfgtANVIgCSbQmJJ4nP2gF7 uNaWqJsCToI5MeC98CUKh39d54uyRbZBkyDUMFhlFm338iT3fqP3lTb40Ri7lsc39eaP qfmKUQh/TPA/9xPYQZGqB8SoBOFBnFkMfAnYe7hew8q7m6eX5LMuSFnljHvBlQy6I/AA 0tO4YMQWrPUL7kxonl6y25KND0p8t6FG0EKd/AZ40Muthfocin/Bn2Z2CJed6ou3QhdP kTZg+Vxivi05n2j/nPTx8WVM4mrVLDekgLtgCWED+XOUpAqtnl67U1oInJqwg7SgWIY1 9ktQ== 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:dkim-signature; bh=YnSnAdZEsBZupCHo1UZadEHdllboI25oiERgENw50C8=; b=vXYp1kqMcmtiXzLx//79Mdx6hfi8nr8GGxfwWURTE2oHjKNc0rZ/e7Ld2pe40p77QJ c0NfLNUWO9rNYQfou5ez35ax3KxQEYfDPPNlEi792U67nE65Z6L1THB7YIQ8U1tFdEje VqUGsU4B/lbDQvzjlf07agT/5P9jWc58ytB2YQFlPQZrqmgT+lAO3T2StPTcmAAjm8g8 JosHkfOw1FSNi0qyRc2MWuqpgD4zCogVuNea4wSx+nfonuQZdOEv0kozjqxYXxCuizhA P45diBE7Sd2AerYdSv7/HBV1Sc9IT8wYPWgXtXygnoJp+XZkbP2jIbkDKccCJnbovrFT YP6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QeIzYFzS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h26si11757802edq.453.2021.03.10.06.23.57; Wed, 10 Mar 2021 06:24:31 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QeIzYFzS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233008AbhCJOXC (ORCPT + 99 others); Wed, 10 Mar 2021 09:23:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:37034 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232776AbhCJOWq (ORCPT ); Wed, 10 Mar 2021 09:22:46 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0EDCB64FF3; Wed, 10 Mar 2021 14:22:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615386166; bh=fvRMVeiCybXoXRnQ1HMKD1A6w2E1RrFY453zPMPS9bg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QeIzYFzS6U9XfE4gOSrLARyy1DuIahTNuflRn5jm+8YYlys39qkTxl/q3dgH9iNJG ndPLxX0aOZHbqQV2u+vMrelNkQHa7h74g3YakwLecNynq9dI2mPOhs9bKAllnN7UQy wQrydj2+NPncQiU6JwYe03wl3rIC2S3FRq8MLNvCNcRV75CnKw2dZoqyj12S5RErbh 3fXrgoVOALucNo7FoNZHE9AxB9KA73w9gxxIiymZySOdXAy+aZ/cne6y2lu1mNBB1H yjvWULnVETMvPNN1zOeQ+D8TvmWsUBdd5L/Xg5P8J3Yxu/DzEjWs2k1aQEQLq1kC50 WuyUONEhhNNiA== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1lJzjk-0008Fv-Qw; Wed, 10 Mar 2021 15:22:56 +0100 Date: Wed, 10 Mar 2021 15:22:56 +0100 From: Johan Hovold To: Lv Yunlong Cc: elder@kernel.org, gregkh@linuxfoundation.org, greybus-dev@lists.linaro.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] greybus/operation: Drop reference when message has been sent Message-ID: References: <20210310141736.3459-1-lyl2019@mail.ustc.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210310141736.3459-1-lyl2019@mail.ustc.edu.cn> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 10, 2021 at 06:17:36AM -0800, Lv Yunlong wrote: > In gb_operation_response_send, get an extra reference > before gb_message_send() with this comment "/* Reference will > be dropped when message has been sent. */". Therefore, we > should drop the got reference not only in the error branch, > but also in the complete branch. > > Signed-off-by: Lv Yunlong > --- > drivers/greybus/operation.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/greybus/operation.c b/drivers/greybus/operation.c > index 8459e9bc0749..500b3fe53a04 100644 > --- a/drivers/greybus/operation.c > +++ b/drivers/greybus/operation.c > @@ -855,6 +855,10 @@ static int gb_operation_response_send(struct gb_operation *operation, > if (ret) > goto err_put_active; > > + /*Drop reference after message send completes. */ > + gb_operation_put_active(operation); > + gb_operation_put(operation); No, this is broken. The reference is dropped in greybus_message_sent(). Johan