Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3798006ybi; Mon, 29 Jul 2019 12:50:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeeqPekU7muiKmOisgPbL4em3f5Wr3GFKtBZziDM6uEHeiZkFi3ax+r09SIBXj5G+TILti X-Received: by 2002:a17:902:f216:: with SMTP id gn22mr109087603plb.118.1564429809042; Mon, 29 Jul 2019 12:50:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429809; cv=none; d=google.com; s=arc-20160816; b=DeYzW7icRPD4WcUW5j5sQc4bIkdGH8xN8zopt+7Pc0mD1zlfaJlDKekeMyyC+icBo5 tbsQ8+z6p0L+QrxRj/OfmXQFXtltN8jUtV759kkBSbqHMOXY0/limWc+LemPhjKSdo6e A6XHr5eAlyAOlErrxZ2K4RPMfkg7OmOkkTDx4o0D9nhuVts8zGdEaCji9CBuFNAUxKDF kluUz3CAz6P5rBrfnuS8VM4HeqX8RJdbpi2pvBCgrDqLetOwLWg/BBruf4wLCj6ZNDxF BD++Typk/OWt0NhhqdxIGfw58dAAstyUQWa7k07GdRL1U0ZHFfy08wv6ieOLSyuO++5c TXOQ== 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=ZcmrGyONlmVtDyDWdyTcT/AgMYLD4vpQ3T6/05wWOtE=; b=N+MLOEtB94AU5UuyiPTnsKSnGph7yKXADNv2Nzj1nFDxLPAfRaApXGUZ5+OTS6h4Dg wYKI/HJuDoeVeYUGvUE0NIZIxOBJ8Y0J5NWYdgSsvCV1pVaRic6gxOveAyppsVe7tkgG BY+vF2bgMASuCt5LaxTmR6P3928PIduABnmt67QkjAEHUR/xgc6DrvL0lMujFxYaNyN/ yF7Q790mlnC+eE/pkAs5MdL5GZdMmz+S3QKQps24QtSm8km9t/Z253B9vd1i3Fc3pxue uLF8PuK4HWZM8nnI7UaDkR3S1YEPO/MKwSI4bxbOR9dx9rMoRM+YxYBv/Zu62Ut0DS5u PbVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="1h/Y4o0k"; 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 t24si28398767pgu.221.2019.07.29.12.49.54; Mon, 29 Jul 2019 12:50:09 -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="1h/Y4o0k"; 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 S2390356AbfG2Trb (ORCPT + 99 others); Mon, 29 Jul 2019 15:47:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:37188 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390347AbfG2Tr3 (ORCPT ); Mon, 29 Jul 2019 15:47:29 -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 BC10621655; Mon, 29 Jul 2019 19:47:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429648; bh=DP5SadGgwHMgpsRuelU8uLN3MrrOAUm48aM4mEa5+O4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1h/Y4o0kOGKShhh6wbXFMSj2t4X6u/tmUV0zyywo2R5AOsz25e47yqzaFeU5omTPs zNZJjtOi+WCL/bFce92hmJYBB2zFsnHoqwEdFRiVHkAizG1Zpp6d61aj63lBFI5BFi Y2VyWWTcLXXqMaqoZZn7oNezs4axsl/OUvk3kX+E= 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 5.2 050/215] tty/serial: digicolor: Fix digicolor-usart already registered warning Date: Mon, 29 Jul 2019 21:20:46 +0200 Message-Id: <20190729190749.174832314@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@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 f460cca139e2..13ac36e2da4f 100644 --- a/drivers/tty/serial/digicolor-usart.c +++ b/drivers/tty/serial/digicolor-usart.c @@ -541,7 +541,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