Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3790190ybi; Mon, 29 Jul 2019 12:40:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEh9+M9gSatPdnEQgVkbEsHgIJzNnttKwhymjhPrqe447eMXTBk23rtBb4rbvvJnyX8wwp X-Received: by 2002:a17:902:684:: with SMTP id 4mr111853820plh.138.1564429226364; Mon, 29 Jul 2019 12:40:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429226; cv=none; d=google.com; s=arc-20160816; b=kjxWwj3tTvS5kPL44KjtUCj6BPw7wx4BkeYYt4PA1mEOTRvi+ZiOfmNDa+oF66NJI9 82grZ0HWE2yUUigwnfoHZf0JQdfkgolcg3TKmjBIkuDKMHK2gHBUGFO8sYg1UOiEzpH/ ykV14Y2/zq5N9S2TNszPz7K7fg5ovMzzxBFL8NJs4kfR6AY7zeiPT2JszqtqMniDBNN/ Lper+Z6J1Pb2Xk7x3CguP3dE7+Xvz8QI4Ue5iQkQk56jlDj33lhSlgR2eiCZOoUAD1xN 0YA3cDHquUU5u5RyWwCqBljumkyUlijoldRFKhX4CY3dR9Op8IBix3zUUTK/puovsuXv 1KRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8A/jx1n8md7epwzj6fvISjsbMqf9o1t7AZBD2YD9Ohw=; b=FO8dIr1EFNnDQXFdIuuhdvfKWB/PSh2+23vGDP9IZ3VMo8SjaIMDJGs3ZgxUIk0qsD 4D26FaaxcWIBVhngDLK7oa/5npCftJl+IGmvZYFPXHzBaE6CCKA/W8h9feYMMyCjjcjQ xJx1Gk0gr4gFXpPICd74djI8siT4mwoW+5zzhYlpLBvihunGdYyqNq9kUcer8gwyFnuL wAyG4V++VVhdP/UuhdkfZPXX8xLEzC+6dZRaQZFkQHG2NiK1cZx50YIkNOJAa2yA6JmW Z7y1G0ha+CLKmDFwpMxil1nu37NixidJnTgEo8XI2VHiIIQiYJl2oscjNyKN67rJ2rSY TtbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HeX3dHfV; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1si13305257pgn.512.2019.07.29.12.40.11; Mon, 29 Jul 2019 12:40:26 -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=@kernel.org header.s=default header.b=HeX3dHfV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388751AbfG2Tho (ORCPT + 99 others); Mon, 29 Jul 2019 15:37:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:52520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388731AbfG2Thl (ORCPT ); Mon, 29 Jul 2019 15:37:41 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 C08952171F; Mon, 29 Jul 2019 19:37:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429060; bh=sw7NaxbdxmEM6aRee2IGjhr908nG873HqFG3gLRoZso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HeX3dHfVoIMM5hOFuqr2H+9+Pj7L76ANiC2hY/Er3gksYvrEcBemoSGYxc2tzzpPJ w6u/Ydq/u21Fix4ciP0XfhqKZ5KXPFIT5Y5yEIA+2HoA3lzXka/b7LoNoOF+L2POUR aVdNXkbbFkWLybNfoQw9tVsQV0ykpZmCDZuK6b6U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Kefeng Wang , Baruch Siach , Sasha Levin Subject: [PATCH 4.14 233/293] tty/serial: digicolor: Fix digicolor-usart already registered warning Date: Mon, 29 Jul 2019 21:22:04 +0200 Message-Id: <20190729190842.338566469@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit c7ad9ba0611c53cfe194223db02e3bca015f0674 ] When modprobe/rmmod/modprobe module, if platform_driver_register() fails, the kernel complained, proc_dir_entry 'driver/digicolor-usart' already registered WARNING: CPU: 1 PID: 5636 at fs/proc/generic.c:360 proc_register+0x19d/0x270 Fix this by adding uart_unregister_driver() when platform_driver_register() fails. Reported-by: Hulk Robot Signed-off-by: Kefeng Wang Acked-by: Baruch Siach Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/digicolor-usart.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/digicolor-usart.c b/drivers/tty/serial/digicolor-usart.c index 02ad6953b167..50ec5f1ac77f 100644 --- a/drivers/tty/serial/digicolor-usart.c +++ b/drivers/tty/serial/digicolor-usart.c @@ -545,7 +545,11 @@ static int __init digicolor_uart_init(void) if (ret) return ret; - return platform_driver_register(&digicolor_uart_platform); + ret = platform_driver_register(&digicolor_uart_platform); + if (ret) + uart_unregister_driver(&digicolor_uart); + + return ret; } module_init(digicolor_uart_init); -- 2.20.1