Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp612059ybi; Fri, 31 May 2019 06:28:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzl/ZCEYSZVK2P11QL7OtOVDDFWAxRXCwG+VfBQ92yEzAcX2BRoVBj9WXdk/nPvv9wtNUrl X-Received: by 2002:a63:e54d:: with SMTP id z13mr9225766pgj.132.1559309320987; Fri, 31 May 2019 06:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559309320; cv=none; d=google.com; s=arc-20160816; b=epDZ0IOlAGBnKWwdf0Qrm6uVd6b1hbpGcns8H6Zgn1P54H7+SzKotUn9GVznoYoLBv wkfDyOhg5IvoRw/aDFAEuLQbfIaQ7/vEEiKSdx52wFmG7HJLdQF7j211dpOALXP8zGbo 6z9qTxkdhcbUpuuElO8fahtrq65yWy5llCWqEZbuTjlLqjHJwqJ5w91FmVGV1pA9gmEp f/12Z+KVc88IjjUqi5mqTFJKe3uyQ9vNVhG5v+ZJUNlDJjPqvUNIWdsezS/X9BDm4r9A 9zNUPjdj32rZhIGS3DI7SZMjaartWlGNVaF6zVf7sw/6NsAyzTJ26CdFlb2U5AcV5W6Q x6Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YqusqY9ZkH6Npoicn+crWGyPEFfsOWB2EFhjTifVbMk=; b=wxR3lq1HkHIP5f4bgZNl88/ROJuBd0CMrbwDyuU0L/ERrVKNFMFXv3sUT6GGtkTrLl kxjn8buFF0VAJfb39grffO9lkLiUZiOVO+uRbFqIpPBzWjkgwrpcd1NLQbcvX0cIrliw ybIOxl5pizlAgEYHEPEE2CZG79CjUpl85OOdFzNqp/endXoRM7LB+HHj2PoQlG/75Z2h x1qVIhOye7Hrjb10NXCnSTkCd9iiIettW+TLO2xFpAh9/B+KhnAyqdWNOe+6FiZxudkq PI2wOtgDTAtir1esGqb7JWmEKAldVEjx6xyPogp+xODWllLqCMcKEzTj4BMWi1D5XvtC Zqxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yTdPijdQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id o7si5904071plk.264.2019.05.31.06.28.22; Fri, 31 May 2019 06:28:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yTdPijdQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726640AbfEaN1D (ORCPT + 99 others); Fri, 31 May 2019 09:27:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:45378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbfEaN1D (ORCPT ); Fri, 31 May 2019 09:27:03 -0400 Received: from earth.universe (host-091-097-002-124.ewe-ip-backbone.de [91.97.2.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C697626963; Fri, 31 May 2019 13:27:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559309222; bh=YqusqY9ZkH6Npoicn+crWGyPEFfsOWB2EFhjTifVbMk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=yTdPijdQt8v7qtRFDw9pFy+qt44JpuV3K/Cz5T4qmw09784Xdt2s9ac02aezUJIUf c4RTjM5ZSMQtaky85KkxQlV6LQfWccRikbhWo5gbE0Gf6tB1HdPYG7bkvCsKugjv6k CNx/lx5Q+ULsMLVHsXWeX6V1O+OqmMlrQAOFFvTQ= Received: by earth.universe (Postfix, from userid 1000) id 3D7443C08D3; Fri, 31 May 2019 15:27:00 +0200 (CEST) Date: Fri, 31 May 2019 15:27:00 +0200 From: Sebastian Reichel To: Pavel Machek Cc: kernel list , dmitry.torokhov@gmail.com, gregkh@linuxfoundation.org, teheo@suse.de Subject: Re: devm_* vs. PROBE_DEFFER: memory leaks? Message-ID: <20190531132700.o7kopr33kdztqdv6@earth.universe> References: <20190531085209.GA20964@amd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="sfcqqzyrmfnzli66" Content-Disposition: inline In-Reply-To: <20190531085209.GA20964@amd> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --sfcqqzyrmfnzli66 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, On Fri, May 31, 2019 at 10:52:10AM +0200, Pavel Machek wrote: > Is devm_ supposed to work with EPROBE_DEFFER? Sure. > Probe function is now called multiple times; > is memory freed between calling probe()? Yes, EPROBE_DEFER is an error code, so devm resources are released. > Will allocations from failed probe()s remain after the driver is > inserted successfully, leaking memory? devm_ is connected to the device, not to the driver. Since code is better than words, check drivers/base/dd.c yourself. The relevant function name is really_probe(), interesting part for you starts at ret = drv->probe(dev) line. -- Sebastian --sfcqqzyrmfnzli66 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAlzxK6AACgkQ2O7X88g7 +po8XhAApEXxQhcTweD9Ef8YuyoQm7NGIQl1kT6QV+Mg9vDgyf4wvowZDEcInCMd Em2OCVHoO6QBEnmq8yci4a1l1hpppH3a7MugZKGBRdS9t1f0tBMdyE5dpU5xYmWX yPfV16JT6Duk47wxVN53DhjNZlpYNVCQL4ok6crOlJWwp3JvfG+GZVXpuEZ+0md5 Qo1iQWVYsOnVljBgKTeQ4ZkcjeRqrUIB7OcJJ4jmV2/t2JurtYr2C9u7BCnG26CC AuBUE5wWQtq30HS79jF0/b9F2sVu2QLf9vfCRt8mayTA+pi3e6qoYsYrvkHOTjTF PuJGb1oxgrJ2YSZm+R0q7GRZIwB2twV3LgTghImzHP85rX3uo8KvJPvbkyTYNMfk NspgQCcJAuNNNRH9rRkMLLuWTx2lCC77mWxNUwfHBltDIphT/3m+JRsnW6VdgA/T xR6yZ/q/ThQZQ0tCPxyEunry62fHbdllcRYCIwJ9CNKSnrO4kWLrDUqop8LUFlq+ b0bSYHHd3+CDT5379zQPlryIlJKy9l2P0vTCwIFDKurOSX+Qi8APnpas4qjD0vAE lPEoPoLUwqWefDbt1t90OSVJCggqIDoTH4q3aOLWPDwvNr4wFXHo7kW37ogwYr6F FM22DHPQUqZqdNyLYnlxonn2h+959laOa0xYN8lR+y5IfrMvTek= =K+Zu -----END PGP SIGNATURE----- --sfcqqzyrmfnzli66--