From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2992467AbcB0MD4 (ORCPT ); Sat, 27 Feb 2016 07:03:56 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:34108 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756545AbcB0MDy (ORCPT ); Sat, 27 Feb 2016 07:03:54 -0500 From: Sudip Mukherjee To: Lidza Louina , Mark Hounschell , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, Sudip Mukherjee Subject: [PATCH 3/4] staging: dgnc: unregister pci driver Date: Sat, 27 Feb 2016 17:33:34 +0530 Message-Id: <1456574615-32003-3-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456574615-32003-1-git-send-email-sudipm.mukherjee@gmail.com> References: <1456574615-32003-1-git-send-email-sudipm.mukherjee@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We may choose to load the module without the hardware present. That will register the pci driver but since probe will not succeed so dgnc_NumBoards will be 0. Now if we unload the module then the pci driver stays registered as dgnc_NumBoards is 0. And if we try to load the module again it fails with the error: "Driver 'dgnc' is already registered." Signed-off-by: Sudip Mukherjee --- drivers/staging/dgnc/dgnc_driver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index 1d1d5c8..22a92d1 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -156,8 +156,7 @@ static void dgnc_cleanup_module(void) dgnc_tty_post_uninit(); - if (dgnc_NumBoards) - pci_unregister_driver(&dgnc_driver); + pci_unregister_driver(&dgnc_driver); } /* -- 1.9.1