Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1312046pxu; Mon, 23 Nov 2020 18:03:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTjwUfy86s9Jcl/0uKEU+j9CZKUTJ49pQkbj/C+1nWhGDKaxHJyn/nGB7pE9Z3pExJvv0B X-Received: by 2002:a17:906:a106:: with SMTP id t6mr2120978ejy.63.1606183438096; Mon, 23 Nov 2020 18:03:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606183438; cv=none; d=google.com; s=arc-20160816; b=aCKzAmi535/lZVleuFY86Qr248zG1AZiH+/VU0Cls+E5NCb7CQIjyMYCLmfI2gWc8R VlKWoJUx38qVE9rHbHFUAznrbptE7xuns/hIpXbvfRuAudvRqR4SGwgYjT0cWuiRIBQF pxYLJ+LR7XLSpzFTCOcgxGMyKb7notSeuVtmCMYP2coDXZP0t5Quh0EpVkAap95mr9nz +t3Omf5uyPyk/fWKMldqQnXWACHgDnI0/MnSg1ReZeIqO/+F1MQVqxsHvBAANSQ2vaXu NkCqgc44w5zlj5WeP+Yn9WBxRS7HKXQNGnYjWnzZRuN8gUkELqbTyu8BPNXrr4xVmpT6 ZkGA== 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=djawVQpacGpvWisCuz1Q9zeMASZ2HkReRzj7KwqMjSs=; b=V0DH1knHdsgJmtyzlnCq2d7Hf8vaWjCTMA37aORUxv2RP0W3pmeKK+IDxJE5Ct7w38 j96h1+OiZytqxQh8cNg+d2ZkdJk+54XcMhX42jsqvcwxhPrlxZOmbimTrCrRQU4YUF+a E/7W9ehNiTv7gOVgFw8me+O715+TZjeOWYssJwjvVssl77H6iC4LYaSOwdYsUFFYKR0G nBV+d8IYEFElwxWWKYgG4jm9obBKd0PwVWfVGD1SWtqebWbVta/xbd98e6YVVhLQUTS5 rpzomMEKgojkS5wEJxTP4HimC+fK5XXwgpSi2DbkohZxBpK34O+1Bowei4lq2PBKr+XR pOOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2KNdOFcQ; 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=pass (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 o3si7403685ejn.637.2020.11.23.18.03.35; Mon, 23 Nov 2020 18:03:58 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=2KNdOFcQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387712AbgKWMwC (ORCPT + 99 others); Mon, 23 Nov 2020 07:52:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:32790 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732811AbgKWMrU (ORCPT ); Mon, 23 Nov 2020 07:47:20 -0500 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 3A88C20732; Mon, 23 Nov 2020 12:47:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606135639; bh=8VlL8wXys/FUVKU0xshPjPqgDI98Hm+FeoxhuntYsIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2KNdOFcQOenIrlQxuJkgQVjpiY+cCZVOAEMN9Bm9TXn7g5iZlMr9c57fI14IWkOmx BvtVMqxb/rmBSHDWihvae+HmYhWn86WVYPghAdOWDr283ynzVQHXd3aa5PwW1Xbxey lgyUgFklrCl9RzCpCNYcZWPXLLnpHYsnyeMI1ie8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde , Dan Murphy , Sasha Levin Subject: [PATCH 5.9 140/252] can: m_can: m_can_class_free_dev(): introduce new function Date: Mon, 23 Nov 2020 13:21:30 +0100 Message-Id: <20201123121842.355071524@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121835.580259631@linuxfoundation.org> References: <20201123121835.580259631@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: Dan Murphy [ Upstream commit a8c22f5b0c689a29f45ef4a110d09fd391debcbc ] This patch creates a common function that peripherials can call to free the netdev device when failures occur. Fixes: f524f829b75a ("can: m_can: Create a m_can platform framework") Reported-by: Marc Kleine-Budde Signed-off-by: Dan Murphy Link: http://lore.kernel.org/r/20200227183829.21854-2-dmurphy@ti.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/m_can/m_can.c | 6 ++++++ drivers/net/can/m_can/m_can.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index 63887e23d89c0..f2c87b76e5692 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -1812,6 +1812,12 @@ out: } EXPORT_SYMBOL_GPL(m_can_class_allocate_dev); +void m_can_class_free_dev(struct net_device *net) +{ + free_candev(net); +} +EXPORT_SYMBOL_GPL(m_can_class_free_dev); + int m_can_class_register(struct m_can_classdev *m_can_dev) { int ret; diff --git a/drivers/net/can/m_can/m_can.h b/drivers/net/can/m_can/m_can.h index 49f42b50627a1..b2699a7c99973 100644 --- a/drivers/net/can/m_can/m_can.h +++ b/drivers/net/can/m_can/m_can.h @@ -99,6 +99,7 @@ struct m_can_classdev { }; struct m_can_classdev *m_can_class_allocate_dev(struct device *dev); +void m_can_class_free_dev(struct net_device *net); int m_can_class_register(struct m_can_classdev *cdev); void m_can_class_unregister(struct m_can_classdev *cdev); int m_can_class_get_clocks(struct m_can_classdev *cdev); -- 2.27.0