From patchwork Mon Nov 10 14:59:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 40494 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E31E0244B6 for ; Mon, 10 Nov 2014 14:58:50 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id e51sf5644841eek.2 for ; Mon, 10 Nov 2014 06:58:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=5KZeLJ2z0LceWpBjHG7Kh2y+8kwQwJLSDlj++4kLSBw=; b=mvsp4nZwADvN7prEYHRoas15EwV7P0MWjqP2Kv+W2x5ehf5fv55y5J7cLfLcb7wt+E /TXKJm99ahVXxHeeoJ5xFmQpPEj3gFhcQJ6SqAoSag1NnfVjNjz5H9TD8X1B75GAG/aX MIwlt2M2LskMQgt+bHnR4tOMwGfx7ovzoSRhxd/aD16ZvWDy7rVXAsuhpyC95oJH7pA7 +iYttK6crVs/4bbrrwWn/QpAr2K6+UvHl3OjsTTSNaZ/ebe02XElK331QhbkP6viirdm Ra+O/0Rc0v+hvn7WRCn+YU2GzMiRJtPKTaByAZXIdFRBKQVv8jQvl+l6204TS6EiOSzc XnwQ== X-Gm-Message-State: ALoCoQm3jSFTpJ3MuJLll4Zsu4WVkwmU88sX2shhdyitgCMIYNplQFFVSx9IgrvgDo5HAwU82FK5 X-Received: by 10.180.221.7 with SMTP id qa7mr4137797wic.6.1415631530177; Mon, 10 Nov 2014 06:58:50 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.200 with SMTP id n8ls319856lag.10.gmail; Mon, 10 Nov 2014 06:58:50 -0800 (PST) X-Received: by 10.112.162.41 with SMTP id xx9mr29506873lbb.21.1415631530011; Mon, 10 Nov 2014 06:58:50 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id kk6si27343804lac.69.2014.11.10.06.58.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Nov 2014 06:58:49 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id hs14so1547233lab.23 for ; Mon, 10 Nov 2014 06:58:49 -0800 (PST) X-Received: by 10.112.12.35 with SMTP id v3mr3045959lbb.80.1415631529763; Mon, 10 Nov 2014 06:58:49 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp101436lbc; Mon, 10 Nov 2014 06:58:48 -0800 (PST) X-Received: by 10.68.164.101 with SMTP id yp5mr19522962pbb.66.1415631526970; Mon, 10 Nov 2014 06:58:46 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qz4si16608555pac.240.2014.11.10.06.58.46 for ; Mon, 10 Nov 2014 06:58:46 -0800 (PST) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752723AbaKJO6p (ORCPT + 1 other); Mon, 10 Nov 2014 09:58:45 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:35781 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752746AbaKJO6p (ORCPT ); Mon, 10 Nov 2014 09:58:45 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id sAAEwfUx000516; Mon, 10 Nov 2014 08:58:41 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id sAAEwf3I027174; Mon, 10 Nov 2014 08:58:41 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Mon, 10 Nov 2014 08:58:41 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id sAAEweCb015405; Mon, 10 Nov 2014 08:58:40 -0600 From: Felipe Balbi To: Greg KH CC: , Robert Baldyga , Felipe Balbi Subject: [PATCH backport] usb: gadget: f_fs: remove redundant ffs_data_get() Date: Mon, 10 Nov 2014 08:59:08 -0600 Message-ID: <1415631548-23674-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.1.0.GIT In-Reply-To: <14155941813440@kroah.com> References: <14155941813440@kroah.com> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Robert Baldyga [ Upstream commit a3058a5d82e296daaca07411c3738a9ddd79f302 ] During FunctionFS bind, ffs_data_get() function was called twice (in functionfs_bind() and in ffs_do_functionfs_bind()), while on unbind ffs_data_put() was called once (in functionfs_unbind() function). In result refcount never reached value 0, and ffs memory resources has been never released. Since ffs_data_get() call in ffs_do_functionfs_bind() is redundant and not neccessary, we remove it to have equal number of gets ans puts, and free allocated memory after refcount reach 0. Fixes: 5920cda (usb: gadget: FunctionFS: convert to new function interface with backward compatibility) Cc: # v3.14+ Signed-off-by: Robert Baldyga Signed-off-by: Felipe Balbi --- drivers/usb/gadget/function/f_fs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 7ad7137..db66be2 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -2626,8 +2626,6 @@ static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f, func->conf = c; func->gadget = c->cdev->gadget; - ffs_data_get(func->ffs); - /* * in drivers/usb/gadget/configfs.c:configfs_composite_bind() * configurations are bound in sequence with list_for_each_entry,