From patchwork Thu Apr 18 10:27:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 162453 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp563466jan; Thu, 18 Apr 2019 03:28:04 -0700 (PDT) X-Received: by 2002:a2e:4ca:: with SMTP id a71mr50776008ljf.39.1555583284788; Thu, 18 Apr 2019 03:28:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555583284; cv=none; d=google.com; s=arc-20160816; b=NIak2ihRXzBrTxtGj4K8d3Tg2ADPdkXm0OJp8Co4GoTDOedsZEkM64OiNhNoQAj69J xIvxIrAxRfOkG4f3vmdlb8nmM6Jogzu5CnfCtUvWKl5vhJd9hMPRGKmwSJJb/2HminLU a0iIBaqfj6e2dG8e9Jr0WS9uEYJehAK3/+zYhFDkcJzydOjnQT5vnsTzyXkZzCY9xe8F WbbIPtc4eoLJV/LTgXqm20edUdWpCVC18atwbG9dpfQWhHkpB2FplvZqKxziTAo1ut3l W+cCN/3CqWz/t9W9UoVcabQARBjoX8NdCIu4SQsL+NyycD5a0YsrpYFTTwEjv7L5CdJd zqGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=b4/z3HQphjEsvzH3BgLLETGidZtveaIsWYroUmoxADE=; b=NPVfneZIqJERmCTIGn46NM6Qzw1LWFL4HdhEu9W5dvooG/FJJALwn6MxfkLjDgy85W RMCAFdcKjgn5JbsklhgstwNYKQopM3XnC74k96tkCFvCv6a5j2jY3YDC70S/4aS/oBL7 QU+PwSnlZH/MTKXo14sB0dnOnE4bm+tlKJ3lt39lIargxuVNcqa8oh8aIZQ1UZSXebHF fMtEnwE0piHHGcFwYc7WKtUspkFAX4mdhbUEzmCho6dsseDf1fAYYBdnzMQoa+f/GLRn g4/wOi9AIbd/DUt3nX297h6R4FPMknC4Lyb1qNn6idhg2OoywI8VfCdRegT2DWSRuoq3 VXbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dqCViXMV; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id e8sor811710ljk.39.2019.04.18.03.28.04 for (Google Transport Security); Thu, 18 Apr 2019 03:28:04 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dqCViXMV; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b4/z3HQphjEsvzH3BgLLETGidZtveaIsWYroUmoxADE=; b=dqCViXMVuDoEwPYSCRyR3gFK2YRd4ueBMYYsoKTDZBk8/sNQkdFgQyT1ulkoSxCdGD iAhP8JNaZwj2TCmXl4f7ZzxEBDd92pX2a3LfqUSWUStUGvg2OeFOK61rFvWTIAyj626k rIrTAHEyRISdxXMPD4TfZNgc9IfKh1Yw6kYNGVf7DZKue9bcPUal+pbuBTdioRI5UYzQ g2s6uRAlhuMFHEZy5QD79ISiwzLfRgqYfdl5sPwWyty5j7YnpeEl9aTv2FrzmZav7vqB B8UbnnltODguhp/+BwLPZyxW6LL/Kai69tJ4yKtrwHIGTv7TVRk6kdHzYn+nmUzxnAVO gZWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=b4/z3HQphjEsvzH3BgLLETGidZtveaIsWYroUmoxADE=; b=WYbQJ9knL3jC9edgDypr+5AR1vpXiS8rlGSm+sVj8Sf/7DAQ0c//2lEyasMyTV8ZrF yZGNac4BNvxAN3Qku4TszADx/4tznx+5JoPsxHRo4By564ODlMe1vqFszOs9N7d5Rka/ MytsvIvgio5JTbo9D6DC7MMN53qXPKHpMzyolitj1uigIf3hTVRegg9JvEF9ifmGuqp+ K9h4NDIc3jAXED6Xsw1/Rmtk/NEqwzZw6vQ5NxobAnGCm9sIrVpoRgsE1Pn2r3V4pcGe PLt8cvb1fhYpbDxqnvI7dlW+YKRNsy14cVehuo9Xq3bx2z1tkh8G2LLGBfhcutps+K4X xPVw== X-Gm-Message-State: APjAAAV4wICZo2M6HFl9XHlh95ovmwRWzwfs/yKh1/CSpXTztuwYC1c7 i//R0Gz+e4AIp7Gu5VI0+YptpSUq X-Google-Smtp-Source: APXvYqyP2XTwEGKrSJgjpvfp4q5+IvD+SZE8dUmwojxp2fDrWNFrJxnGtyOuJAGcHcPBpX8n/+BePA== X-Received: by 2002:a2e:810d:: with SMTP id d13mr37663132ljg.93.1555583284116; Thu, 18 Apr 2019 03:28:04 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id l13sm320409ljj.96.2019.04.18.03.28.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2019 03:28:03 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Greg Kroah-Hartman , Jon Hunter , Rajendra Nayak , Viresh Kumar , Niklas Cassel , Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] PM / Domains: Don't kfree() the virtual device in the error path Date: Thu, 18 Apr 2019 12:27:55 +0200 Message-Id: <20190418102757.1246-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190418102757.1246-1-ulf.hansson@linaro.org> References: <20190418102757.1246-1-ulf.hansson@linaro.org> 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(-) -- 2.17.1 Acked-by: Viresh Kumar Acked-by: Niklas Cassel 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); }