Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp517734pxx; Wed, 28 Oct 2020 10:07:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXcAsbhBroL9KNL6KDzA4sdbdrYXsjWbuBhcRA3QmpfOWsEwLT21ENpRW+wVAAmZVwIBEk X-Received: by 2002:a7b:cde8:: with SMTP id p8mr415857wmj.96.1603904869549; Wed, 28 Oct 2020 10:07:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603904869; cv=none; d=google.com; s=arc-20160816; b=QHCHMMY3XTXcFyZmrW9aiUlvseO7TxNb6QoPP08jBLQ5TEvdJxZ0TH9MbjiUEtQs1J ZDTWJq1ACBHr7J/pqbUuk8ZxJli7LYC1BCuIFbTG4wTsJRd1i4AzUm8rx7WYeMb87h9+ wSfS7zotKSja/2nqTBzhHPSNeNDgAd17DNT0hq/1ffx6A3tD9v5nxkG8A8r2WZHDEWM0 Kq0LW6v2A7tQfkph7yTmfWaDGFytzVQ/sVqse0/RnPfKuq/EPwVrYWH82bj10XAxI/gb 3GF+G5Emb9ygk+FVPJ9NxyKtRwUiUuc75jXNevjidSV1KZxfQ1MIo5uPEZzVzC9O0rG+ Y6LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=usAu7c3L/nh/UR3XWkfLASe/4LqNADGsITOqBZUYu6k=; b=mcO11bepMN2HFA6ImiidWT4epASv8gim7pyLrj1RAkVcDAfiCc+uILpqFP5rlciiMh 4zbi8UUWw389nMhCjzXfzVYv9ax0kV3opMVdHpVMtURiSKMAHH2qDdhzqvKvtRzg6S9N 3p/TBkb3gQMtj0fkIKsa5dAq5Fh0L2L98ryiQxFgFnaah1iKHZr8bPkMG8kYCsqXEjMI p5Nt7roruduT9J6xUE6Z6UJ6haN4C4Z61my6Mk1wgEBCLA1jWIDJ3lOCZKrBwMxsvBYj eCxBh8CnBBYyak9YzwAnQ0KtsSWdS4SVStkcLrjb/HIx9sQnaKDOCM8IlqqP3nn5WMPi VIwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f4rBk9nN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e13si3955588ejq.552.2020.10.28.10.07.21; Wed, 28 Oct 2020 10:07:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f4rBk9nN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1820126AbgJ0RdC (ORCPT + 99 others); Tue, 27 Oct 2020 13:33:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:40506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1749907AbgJ0OlI (ORCPT ); Tue, 27 Oct 2020 10:41:08 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 C37322225E; Tue, 27 Oct 2020 14:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809668; bh=vCRqwvqes9Ejty9PXANcAb0O2tpfPAgPoRQIacUAnWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f4rBk9nNJwQXYHJiTppjiRvTFKZI64/ugTC4STDIv/Nb+6wDsQzJDnwthme43OH94 NLtBkqL9xT9lrAozF+jbac0GGIKwLFQpiJYSq2o8+EIqA4hRew4awJS2S6xWx/ZOLI sqyRPAcYN/YU6uylBJ6i1cnRJBIBeHe+ilvM0jGY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 5.4 276/408] watchdog: Use put_device on error Date: Tue, 27 Oct 2020 14:53:34 +0100 Message-Id: <20201027135507.851065639@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dinghao Liu [ Upstream commit 937425d4cd3ae4e2882b41e332bbbab616bcf0ad ] We should use put_device() instead of freeing device directly after device_initialize(). Fixes: cb36e29bb0e4b ("watchdog: initialize device before misc_register") Signed-off-by: Dinghao Liu Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20200824031230.31050-1-dinghao.liu@zju.edu.cn Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/watchdog_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 694357f2816b3..8494846ccdc5f 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -1000,7 +1000,7 @@ static int watchdog_cdev_register(struct watchdog_device *wdd) pr_err("%s: a legacy watchdog module is probably present.\n", wdd->info->identity); old_wd_data = NULL; - kfree(wd_data); + put_device(&wd_data->dev); return err; } } -- 2.25.1