Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp412135yba; Thu, 18 Apr 2019 03:31:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyz5a14s92+dJ6lDnXjuPxAYnNPUN/jORP2ZLAU5rqHQyS4aZqW4x91b9ZvDoFaTorg+s6t X-Received: by 2002:a63:c45:: with SMTP id 5mr88759261pgm.385.1555583467773; Thu, 18 Apr 2019 03:31:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555583467; cv=none; d=google.com; s=arc-20160816; b=IQdCggL8MhhRyHlh9evO73OVVZY7xKkknxyKxnDEHBsP0RU+OV0rEmZESG1IeOe869 vwGodyMIr3QxKRqm4Pb2Ya0rDaIP1KpGLiM1ZcusMQ3Oa9t/mvmeyDx0+DIoxgXYcYML 91igWPEUaGbdnQHSyQ0VQV/bT4j3YY7mEnMxJzCv2hRQP+yR38iVSCOYCeUyA1Xmd3YI Sw3J0eMgMp4Li+X5e1zDaisy4ENBeSVxx5rzhlBOeDbcsdZvBrIxKuO4agB7w9WMcQmu 5Vxa31KIWy4pyqkckDPH5tCP08FsGSwt47r2PUrd7H0+YYfqyXYXfqcT3Tmy6KzkXo1W c7YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=b4/z3HQphjEsvzH3BgLLETGidZtveaIsWYroUmoxADE=; b=au/OIvnNT+noshRI9G5tt+wRzIpw+aMaBBKtYQT1Ks8WeHiSMWTV2w3sxzId0LtkHA eKKOnNJchO1iFu+I/+5sRJQVCb/jxusZjXC5z6DevpXvNnvqZtAszb2MJOkn4dTC/dIx lJEhwn1/3hesQVE+pvlO/iMz3h0ihBeHXxWn5woWnkd3oVZWA5QCeYaWZ/binogN2Ykc KZBXMAIrBwqniR9e4jouHSiPVat7e9GBa1n/Ll8Ua0oso1lHUHKwxnq6OaacZR7cFZB4 VZJV7wopfvYUsTLKBd+WhWbgi6Tf+AckjwcoR7w75EA3AAY8KdOIs8HS83QpZ2ntQQCP cYVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dqCViXMV; 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 o7si1744937plk.215.2019.04.18.03.30.52; Thu, 18 Apr 2019 03:31:07 -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=dqCViXMV; 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 S2388701AbfDRK2H (ORCPT + 99 others); Thu, 18 Apr 2019 06:28:07 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:39138 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388301AbfDRK2F (ORCPT ); Thu, 18 Apr 2019 06:28:05 -0400 Received: by mail-lj1-f196.google.com with SMTP id l7so1469530ljg.6 for ; Thu, 18 Apr 2019 03:28:04 -0700 (PDT) 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=adgiZ5HPk2nmsjO5kmJHAIjTe3svCQ/7jOdOSsQJYmvf+BL+UToIDRtwm5vix5qvNY z6OVLHZf9eNcYstpS360JvtY30AaNheYVnjyoM2HLvKCGFdPdqpuA+S2H9TDGDmsAYWD dqEsk4CVCWlczoX5mNfLx0KpOk1+WKExg2qTo1uJjsdZ72O/3VFYxUWx7sPXhkQyK6fh Ie1vE27pm8mSz/X9qy382cgkhqPai4t3NLuiNioUES3oHNxoEgYOj5KBG3e3Opqz4jpm 2trGiaEl8NkXaVrf9GdWr7++iaz7J+G2RwWjQORLm7rSxQIqIa9NVIiPcAchI3Rva8Qs kG+w== X-Gm-Message-State: APjAAAWmVr9MAzfVqRZ32sAbBaFm2d6PxpjkPJ6NecSIt+NI4d52MH8B bCelnf3D2k6WD4TP88zveL7MzQ== X-Received: by 2002:a2e:810d:: with SMTP id d13mr37663132ljg.93.1555583284116; Thu, 18 Apr 2019 03:28:04 -0700 (PDT) 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) 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