From patchwork Mon Nov 10 15:19:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 40501 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 31E42203C0 for ; Mon, 10 Nov 2014 15:19:49 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id mc6sf5293868lab.7 for ; Mon, 10 Nov 2014 07:19:48 -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=YDGFTcGpZkmJcUvuj+e/aNAW0LmIVhIoaf2D93bk+Ec=; b=Bz09UFPFm7uXowtcd1UxRcnHtH7x6znr48Zn+gorVMxqBVvbpsQ/EKJbpMNU2RW1VZ Cfjr1gCbjPBJ0++F7na5KYj7CPxt0/A2qquEfkrQab3PSPg5Hr/jZ4m2vN/GT6Le9YXj uQN1T7xlwXOQp5OnBA6Ce6yutwarm0uB1BDM2w8GHMEjWwGUxIT25oQMS2dlkx3SLNFC aVZkB/0Q+kRM62tda76jR1TyLaKLLRg0F5PVVdFxERGDv2z1vQcj7BiawQdvgYRDZA9V t30Ki4I1GtS0evN67diBk8lHC3ycGqMXb+pISnMuroYxbHZLdEEKZ+ha5x1OccNtjUty /jpQ== X-Gm-Message-State: ALoCoQlB5IrG9nnOa4N87XLxVhXf9jx3MGic0tNzIXOB7cr6OGdUjbYDOM6TvVFu+PKCieFPvcR+ X-Received: by 10.181.13.80 with SMTP id ew16mr2356366wid.4.1415632786112; Mon, 10 Nov 2014 07:19:46 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.103 with SMTP id l7ls461956laf.6.gmail; Mon, 10 Nov 2014 07:19:45 -0800 (PST) X-Received: by 10.112.41.168 with SMTP id g8mr29490422lbl.59.1415632785797; Mon, 10 Nov 2014 07:19:45 -0800 (PST) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id b2si27351774lbm.104.2014.11.10.07.19.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Nov 2014 07:19:45 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id b6so5961692lbj.16 for ; Mon, 10 Nov 2014 07:19:45 -0800 (PST) X-Received: by 10.112.202.104 with SMTP id kh8mr30178893lbc.46.1415632785556; Mon, 10 Nov 2014 07:19:45 -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 ew9csp105680lbc; Mon, 10 Nov 2014 07:19:44 -0800 (PST) X-Received: by 10.68.189.67 with SMTP id gg3mr2916762pbc.158.1415632783854; Mon, 10 Nov 2014 07:19:43 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rv6si16857012pab.41.2014.11.10.07.19.42 for ; Mon, 10 Nov 2014 07:19:43 -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 S1753005AbaKJPTf (ORCPT + 1 other); Mon, 10 Nov 2014 10:19:35 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:43773 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753112AbaKJPTd (ORCPT ); Mon, 10 Nov 2014 10:19:33 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id sAAFJTZx003814; Mon, 10 Nov 2014 09:19:30 -0600 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id sAAFJTNw017913; Mon, 10 Nov 2014 09:19:29 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Mon, 10 Nov 2014 09:19:29 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id sAAFJSjI024438; Mon, 10 Nov 2014 09:19:29 -0600 From: Felipe Balbi To: Greg KH CC: , Robert Baldyga , Felipe Balbi Subject: [PATCH backport v2] usb: gadget: f_fs: remove redundant ffs_data_get() Date: Mon, 10 Nov 2014 09:19:57 -0600 Message-ID: <1415632797-28618-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.1.0.GIT In-Reply-To: <1415631548-23674-1-git-send-email-balbi@ti.com> References: <1415631548-23674-1-git-send-email-balbi@ti.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.217.171 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/f_fs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 5bcf7d0..afd0a15 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c @@ -1995,8 +1995,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,