Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1188757ybi; Fri, 2 Aug 2019 10:48:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMl6HvO5+TqHxUmOvDSW/Ehcdqqls2bvkpxVwwDTuG6ITcZJ16T87Sbql+9bSbAtUDFjvQ X-Received: by 2002:a17:90a:ad41:: with SMTP id w1mr5408424pjv.52.1564768093240; Fri, 02 Aug 2019 10:48:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564768093; cv=none; d=google.com; s=arc-20160816; b=RomePbHhuwPwH4NoIX81mYIknqcFs6EYAO38wzwvOz+/dUv54rIXVmgTwN/9WJqSPM NOovOn+dA2svqcjDk6XHQy2Tbnnm4l4B8NSgQQnSml8Ic5aZ+WeE/oBwVMvb206vFOK1 aJ/NHHrMmxsIrKVu9YZPipcKeyvTLcvdj1Ln10pbhZb3Hi4xyflpmXHf7miKM0osGfBH Xf+mLXgGC5EWLCcX5Y5CPT2ta0+VooQqGZNzO7AKcN40EIrj8AMu1NL1UMeQxDu4ErWK L75sTdx57FRTfcbX++JvIoPFvtQ8wCnoWSUt9/rGGQ1K5ZIzhlgWdQgiYgBOoSSXpW66 1Dfw== 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=hOPGsWjopuMGerKBD2SCk+xbU3vqlYHXH1TfWVeAgPvpJHzwZnHYLEZaq763R4RHTy RcX03AEfaUMFXMANgVakkIM5O3XEgZvaKLqKRdxJl4i3eLxxpapLrzpW+cRCSOFSjf8m 6oyFYhmyKQOqTzddfA2jjngG0xW+F3OdvPdrmJ/7s2oESNdG4RFiM1+CsT480rQwndqj Q88TcP8snUB8m6eCfXxGOH60zaCcOrT0BAY6Pjp5aaKMq0D2Rn+bGZRpdArCkOWD+Jgp i0kfNyE4V0vgaEvckp4Vzxks4gBOsRAKvpug2eGUu4DLSFReXkSJH1VaoO999HZbcvux vZyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MJY+GaKR; 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 y13si40106704pfp.133.2019.08.02.10.47.57; Fri, 02 Aug 2019 10:48:13 -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=MJY+GaKR; 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 S2405959AbfHBJtI (ORCPT + 99 others); Fri, 2 Aug 2019 05:49:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:54214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405300AbfHBJsn (ORCPT ); Fri, 2 Aug 2019 05:48:43 -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 B91F8206A2; Fri, 2 Aug 2019 09:48:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564739323; bh=sw7NaxbdxmEM6aRee2IGjhr908nG873HqFG3gLRoZso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MJY+GaKRG4x5D+BqA/u0Nbg/IFkEojDdm5ZtUHQ8sf8YoASB/gUroMORqjcf9C8ZO x+s8i2KSMwxGXHMDgLHsYb9h8HYaPGhpuhaAa4+KWdxbkRdpepDdtFZ0r61IclRIYS +DfWhRPPIWUAVK9g3YUsiW03HAhwG41AtbG++53E= 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.9 167/223] tty/serial: digicolor: Fix digicolor-usart already registered warning Date: Fri, 2 Aug 2019 11:36:32 +0200 Message-Id: <20190802092248.856080642@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092238.692035242@linuxfoundation.org> References: <20190802092238.692035242@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