From patchwork Fri Oct 17 17:09:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 38919 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 9C7DA202DB for ; Fri, 17 Oct 2014 17:11:01 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id d17sf795191eek.6 for ; Fri, 17 Oct 2014 10:11:00 -0700 (PDT) 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=yMhyFZ9sM3ScJTeGrZat0VeDIm0IZUcwh2Q/B6FRyNY=; b=gzqd7/iPxHYwzYeHI0EqOFdOrAshedYuIdcgpbY5jGLeaAupy2pwD9UR2tKfT3TAYi YeC4bv5rGXaDmAxiAwcIcACrbThysXFpceMZOjo6P991UdmQ1dnsIpcp8K/YyyuOy0sg yHwBtGlJDJ78YZWis/dUkF2xMjxUIiD+sL4YTExzK6JB2rHy4XZye4BDMxb2YYHHwuaL XbgkgwXMfjzMj3dp29GoVgb4VC6j7pI3XYKlObo8PKJ2lGT/feNMAcOUjIzyydJrjYSe a9/RR+0y5rvabu0K8Dh5gNi+d3PIGjwbDISM2rPLaVEXbd5/a+GS1SMoIWJ+A9hucad7 fgqw== X-Gm-Message-State: ALoCoQljfb9E2ByO/32jhANermJDzxAlIdBm60bcw6FntTWQBYaCY1+yYZqgKvf4gY8AuQoEDM6v X-Received: by 10.152.21.170 with SMTP id w10mr579006lae.6.1413565860806; Fri, 17 Oct 2014 10:11:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.201 with SMTP id v9ls99415lag.25.gmail; Fri, 17 Oct 2014 10:11:00 -0700 (PDT) X-Received: by 10.152.21.135 with SMTP id v7mr10336498lae.65.1413565860699; Fri, 17 Oct 2014 10:11:00 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id h3si2948529lbc.88.2014.10.17.10.11.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Oct 2014 10:11:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id q1so1055220lam.32 for ; Fri, 17 Oct 2014 10:11:00 -0700 (PDT) X-Received: by 10.112.130.41 with SMTP id ob9mr10035519lbb.74.1413565860623; Fri, 17 Oct 2014 10:11:00 -0700 (PDT) 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.84.229 with SMTP id c5csp266804lbz; Fri, 17 Oct 2014 10:10:59 -0700 (PDT) X-Received: by 10.68.162.100 with SMTP id xz4mr9946811pbb.138.1413565858655; Fri, 17 Oct 2014 10:10:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si1689853pdo.55.2014.10.17.10.10.58 for ; Fri, 17 Oct 2014 10:10:58 -0700 (PDT) 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 S1753633AbaJQRK4 (ORCPT + 1 other); Fri, 17 Oct 2014 13:10:56 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:36012 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753578AbaJQRKl (ORCPT ); Fri, 17 Oct 2014 13:10:41 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9HHAcre024914; Fri, 17 Oct 2014 12:10:38 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHAcXj023251; Fri, 17 Oct 2014 12:10:38 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Fri, 17 Oct 2014 12:10:38 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHAbni027191; Fri, 17 Oct 2014 12:10:38 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Robert Baldyga , , Felipe Balbi Subject: [PATCH 23/28] usb: gadget: f_fs: remove redundant ffs_data_get() Date: Fri, 17 Oct 2014 12:09:59 -0500 Message-ID: <1413565804-13061-24-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.1.0.GIT In-Reply-To: <1413565804-13061-1-git-send-email-balbi@ti.com> References: <1413565804-13061-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.215.45 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 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 7c6771d..12dbdaf 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -2663,8 +2663,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,