Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp962427yba; Wed, 24 Apr 2019 12:31:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzY7QvGKMDMqKoetvTdG1tYVZDN3YHxRrcvG4Xzw5C8RtRewE9P5m+k07kSDjC6ExXMj953 X-Received: by 2002:a63:c54a:: with SMTP id g10mr8897490pgd.71.1556134304175; Wed, 24 Apr 2019 12:31:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556134304; cv=none; d=google.com; s=arc-20160816; b=DeoBFx93qXeQAAxm7YOZpi8eafIp++eA8CKqRdd8D4RtmdbHEP8rMFhjHe1g5MD413 w2+J6t7T1UN6S0I2h5tOKfrC/0a25oWaxouvBkCcvkvFekmtGFKKDy0W6PhqlJKMymQB hLPLnUHvsqRSiDWXBjKlhVx+Sjs3R4CWoPLTfoHa8DpEKJTDWlg+SJ7su36SztGqR/OT hgeA2brLLgv3AO7xra2tl6bD6Ms1lav3zbxN5MKhion8I44JMRVPkLzU4kobArsZE6SE OGkmLhtiKzsy4Bjn06WAykHTOyxcfl9LjCMfd0GGmL9e9gR0aPo90CibGcaHfH4yG4Ll Ulug== 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=zzvC/I/Gu9rK4bmZmQZJou+6+hsvOOS4ENInmjNp8gE=; b=QoygON8qE6ZtNlITuS4E+3/fTzgMTGYKCgZn9hg4JAtPPtJ6jhF7yuTOqD6Uj8qbwD X7g4SfBCWAe/CgRfb5j/QdtXwOTIRZQv78B0SbRTQNOjm9H1snMqnNF5/4nKD0L2eI6z tron5bcD7zeCSdi+q3BUk2mel4JNrgmih3cuRB25PBU+P2y+ctQh1UrqnuGj6H0X8nDh fky66rTwcR59dQC5iq0YQCbxtudlqiT67c+guMvyDNYb68JwNKcgmV43PCyq/8Hyg0+K dlJ8RjV8HPkMitJvX8je1m2SoNyiIA/BVojA244PrVLL6EmPzE5GlakSsZFLAP/dQknf SMLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fvFgMT0H; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11si19333525plp.278.2019.04.24.12.31.28; Wed, 24 Apr 2019 12:31:44 -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=@linaro.org header.s=google header.b=fvFgMT0H; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727009AbfDXL2Z (ORCPT + 99 others); Wed, 24 Apr 2019 07:28:25 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:35876 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfDXL2Y (ORCPT ); Wed, 24 Apr 2019 07:28:24 -0400 Received: by mail-lf1-f66.google.com with SMTP id u17so14381743lfi.3 for ; Wed, 24 Apr 2019 04:28:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zzvC/I/Gu9rK4bmZmQZJou+6+hsvOOS4ENInmjNp8gE=; b=fvFgMT0HFBUbT6XcwleukJ1uTKZ7GnMk+kJBkPIB2CxyQgYqxvL2ic0eIzKnM0xnX6 creck7YFBKo8cucKEQQWWfIiBnzxNc9bLad9CXJWHfnoePjqAcmOJpdIEDgM91h7LuoS 1g6UYE11IERvENpFobkhwvmRD4ANGDR7bNwvhZqriHoIEAkBpamIlpaIYG/9bMdD1iMP zO9+nAXRKmSE8i2yEVJ2+Fz51F0Es+G8Y9/fPrhja4rWo54MAiSJXxum1+JT2UGtgjKq UfCgzawENXAuV0fiyWcj1sCrUHQ7a7vj4uiUce2rvZMoA8SP1YNIoOu2j0tvIHN87Jl4 BKwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zzvC/I/Gu9rK4bmZmQZJou+6+hsvOOS4ENInmjNp8gE=; b=MSakCBFilHWuqsimk+fFSgj7a4EkyGv2JHOloYc3JMtAZdfxyuIotfQ/WMEUTZ82uo BqJTsWxmcI4CauhA2scIIKnz+y8pfJ6DzI++4fNaAOEnSqdENuV+emkgc99sdlz5q0rx wBkNHk4mRUUIawZxvKebYW4P2Uovnakj30m299Nop2n9pG3h0q57NAE+UeNhbZ8+M7Uv x/PNEPiQcx+dsb9u0GFY2cJTgkYe/O6WcJxIzO4tQ3iMtqV3Qy+y2i5AXlezwQ2kM26G sHmCHRIKmNht95bPju6sdSve3lBtGa0jAfuPuw0DsDOtmY43LjM6oTT9MPOdwWeInmhT SLlA== X-Gm-Message-State: APjAAAW0cVVtBqJaCs7MItkXMCJMxEXj2F+UnUvnxKQFcVvz3OCHmE64 pxTJQ2R1ALcs+WpJpgkHJhtCCw== X-Received: by 2002:ac2:518b:: with SMTP id u11mr17974012lfi.46.1556105301834; Wed, 24 Apr 2019 04:28:21 -0700 (PDT) Received: from centauri.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id k73sm467649ljb.6.2019.04.24.04.28.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 24 Apr 2019 04:28:21 -0700 (PDT) Date: Wed, 24 Apr 2019 13:28:18 +0200 From: Niklas Cassel To: Ulf Hansson Cc: "Rafael J . Wysocki" , linux-pm@vger.kernel.org, Greg Kroah-Hartman , Jon Hunter , Rajendra Nayak , Viresh Kumar , Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 1/3] PM / Domains: Don't kfree() the virtual device in the error path Message-ID: <20190424112818.GA30710@centauri.ideon.se> References: <20190418102757.1246-1-ulf.hansson@linaro.org> <20190418102757.1246-2-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190418102757.1246-2-ulf.hansson@linaro.org> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 18, 2019 at 12:27:55PM +0200, Ulf Hansson wrote: > It's not correct to call kfree(dev) when device_register(dev) has failed. > Fix this by calling put_device(dev) instead. > > Fixes: 3c095f32a92b ("PM / Domains: Add support for multi PM domains per device to genpd") > Signed-off-by: Ulf Hansson > --- > drivers/base/power/domain.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > index ecac03dcc9b2..7fec69aebf46 100644 > --- a/drivers/base/power/domain.c > +++ b/drivers/base/power/domain.c > @@ -2528,7 +2528,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, > > ret = device_register(virt_dev); > if (ret) { > - kfree(virt_dev); > + put_device(virt_dev); > return ERR_PTR(ret); > } > > -- > 2.17.1 > Acked-by: Niklas Cassel