Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3134239ybi; Thu, 18 Jul 2019 21:42:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5beETT+nGkqQ5UkRC/ggVxb4szwPGpK/ypMHnz8NOxcPwBn4CkADIQj6NCUeXIxMtm/Hc X-Received: by 2002:a63:db45:: with SMTP id x5mr39707686pgi.293.1563511320880; Thu, 18 Jul 2019 21:42:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563511320; cv=none; d=google.com; s=arc-20160816; b=N9A3NtSLZBGd8ATmB7VAnZVAEjf9oIMuOxJNwKwY0+Oi5q3zawbTuaxd7OqvAP6wDP 7nyHaqfnteNzLPt8y5d3TNqxwreJs7GIKtE+d3LOjUfJL5O+pLOC21S7NpLmt818Y8qM ZeWoyOQl15U78qftrbJO79mCU24Jj231AudUxOoDp1SkbrSO2mdAHFGgHaitQ5vkKvZA fVmbcznKfJ1Cf5Zk+IhPHacw7fmIEoBXVxgk9Stupwkj/JDwqcc7X0Afow4lt8/hwPOW s/QdsuMnq/O6cJWnl0MoGN6JqudEDWWd8s9rvTYUPSXkRc4fm8eyirKxfOVv0iMaYCpk Xo6w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=p8xCTWstuUKgGX92wLFp2q22D/BIzTUSj2X31V7YVzw=; b=tTHLkRPQLaqCr5GgaFGuDF32TBNqL6tlINihEsal6zbY+n5tlS0Z/Ng+YwkhKmaXQ8 csdQUYNxOxEZuPgYDjlag1Hv0B3QZkfmRUHz9rB/ZBqT52eumjHYuzZ4Hnp6phsl72cV mBAGBz68DsMbQSaDaYJNBwHhpvzqBfF+g5Qz6lEnD/ro3ks91gK2GDJMMxRe7yqh05Es PXfGh8BOuolHp4w7oOBmMvLTtVHzsRu3tmvnDmtA3HCgC15CJkyteulkFBaF54hn0jui xO/riV1jPCtDkGDFcN1Uvv7t8fyzmKpLkqs3qXrfsg41Sm9opBWAtrMMhoqw9rbV+6ea 0Q/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AGRasT+W; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si3682447pgk.384.2019.07.18.21.41.45; Thu, 18 Jul 2019 21:42:00 -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=AGRasT+W; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728189AbfGSD6h (ORCPT + 99 others); Thu, 18 Jul 2019 23:58:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:57948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728134AbfGSD6d (ORCPT ); Thu, 18 Jul 2019 23:58:33 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A2EB92186A; Fri, 19 Jul 2019 03:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508712; bh=d3e4tqvNiIM0DHagGPl0Sq0p/6aSS+We4bM12lQE+Fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AGRasT+WozgKcqz6ymQ2FXS7eCa+cdc5Gqbvmy5YbrY544YpLYP9f6sgbAr77XVB1 gO+HmISeUTd95nI3pBgOIQi/MH1NuM2E20p1u2A7JTxoF1EwoNeKfxEPB1SVPLnKAu NUOguGc+IvtekMvYPb2CBLRqSUHvnRmjs6s2ad2I= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kefeng Wang , Hulk Robot , Baruch Siach , Greg Kroah-Hartman , Sasha Levin , linux-serial@vger.kernel.org Subject: [PATCH AUTOSEL 5.2 048/171] tty/serial: digicolor: Fix digicolor-usart already registered warning Date: Thu, 18 Jul 2019 23:54:39 -0400 Message-Id: <20190719035643.14300-48-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kefeng Wang [ 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