Skip to content

Commit 68fc4fa

Browse files
mitaLinus Torvalds
authored andcommitted
unregister_chrdev(): ignore the return value
unregister_chrdev() always returns 0. There is no need to check the return value. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Takashi Iwai <tiwai@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent cb00ea3 commit 68fc4fa

9 files changed

Lines changed: 9 additions & 31 deletions

File tree

‎arch/cris/arch-v10/drivers/pcf8563.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,7 @@ pcf8563_init(void)
180180
void __exit
181181
pcf8563_exit(void)
182182
{
183-
if (unregister_chrdev(PCF8563_MAJOR, DEVICE_NAME) < 0) {
184-
printk(KERN_INFO "%s: Unable to unregister device.\n", PCF8563_NAME);
185-
}
183+
unregister_chrdev(PCF8563_MAJOR, DEVICE_NAME);
186184
}
187185

188186
/*

‎arch/cris/arch-v32/drivers/pcf8563.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,7 @@ pcf8563_init(void)
193193
void __exit
194194
pcf8563_exit(void)
195195
{
196-
if (unregister_chrdev(PCF8563_MAJOR, DEVICE_NAME) < 0) {
197-
printk(KERN_INFO "%s: Unable to unregister device.\n", PCF8563_NAME);
198-
}
196+
unregister_chrdev(PCF8563_MAJOR, DEVICE_NAME);
199197
}
200198

201199
/*

‎arch/sparc64/solaris/socksys.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,5 @@ int __init init_socksys(void)
199199

200200
void __exit cleanup_socksys(void)
201201
{
202-
if (unregister_chrdev(30, "socksys"))
203-
printk ("Couldn't unregister socksys character device\n");
202+
unregister_chrdev(30, "socksys");
204203
}

‎drivers/char/ip2/ip2main.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,7 @@ cleanup_module(void)
425425
printk(KERN_ERR "IP2: failed to unregister tty driver (%d)\n", err);
426426
}
427427
put_tty_driver(ip2_tty_driver);
428-
if ( ( err = unregister_chrdev ( IP2_IPL_MAJOR, pcIpl ) ) ) {
429-
printk(KERN_ERR "IP2: failed to unregister IPL driver (%d)\n", err);
430-
}
428+
unregister_chrdev(IP2_IPL_MAJOR, pcIpl);
431429
remove_proc_entry("ip2mem", &proc_root);
432430

433431
// free memory

‎drivers/char/mbcs.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -816,12 +816,7 @@ struct cx_drv mbcs_driver = {
816816

817817
static void __exit mbcs_exit(void)
818818
{
819-
int rv;
820-
821-
rv = unregister_chrdev(mbcs_major, DEVICE_NAME);
822-
if (rv < 0)
823-
DBG(KERN_ALERT "Error in unregister_chrdev: %d\n", rv);
824-
819+
unregister_chrdev(mbcs_major, DEVICE_NAME);
825820
cx_driver_unregister(&mbcs_driver);
826821
}
827822

‎drivers/char/stallion.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4795,7 +4795,6 @@ static void __exit stallion_module_exit(void)
47954795
{
47964796
struct stlbrd *brdp;
47974797
unsigned int i, j;
4798-
int retval;
47994798

48004799
pr_debug("cleanup_module()\n");
48014800

@@ -4818,9 +4817,7 @@ static void __exit stallion_module_exit(void)
48184817

48194818
for (i = 0; i < 4; i++)
48204819
class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i));
4821-
if ((retval = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
4822-
printk("STALLION: failed to un-register serial memory device, "
4823-
"errno=%d\n", -retval);
4820+
unregister_chrdev(STL_SIOMEMMAJOR, "staliomem");
48244821
class_destroy(stallion_class);
48254822

48264823
pci_unregister_driver(&stl_pcidriver);

‎drivers/char/viotape.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,15 +1098,10 @@ static int chg_state(int index, unsigned char new_state, struct file *file)
10981098
/* Cleanup */
10991099
static void __exit viotap_exit(void)
11001100
{
1101-
int ret;
1102-
11031101
remove_proc_entry("iSeries/viotape", NULL);
11041102
vio_unregister_driver(&viotape_driver);
11051103
class_destroy(tape_class);
1106-
ret = unregister_chrdev(VIOTAPE_MAJOR, "viotape");
1107-
if (ret < 0)
1108-
printk(VIOTAPE_KERN_WARN "Error unregistering device: %d\n",
1109-
ret);
1104+
unregister_chrdev(VIOTAPE_MAJOR, "viotape");
11101105
if (viotape_unitinfo)
11111106
dma_free_coherent(iSeries_vio_dev,
11121107
sizeof(viotape_unitinfo[0]) * VIOTAPE_MAX_TAPE,

‎drivers/net/ppp_generic.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2684,8 +2684,7 @@ static void __exit ppp_cleanup(void)
26842684
if (atomic_read(&ppp_unit_count) || atomic_read(&channel_count))
26852685
printk(KERN_ERR "PPP: removing module but units remain!\n");
26862686
cardmap_destroy(&all_ppp_units);
2687-
if (unregister_chrdev(PPP_MAJOR, "ppp") != 0)
2688-
printk(KERN_ERR "PPP: failed to unregister PPP device\n");
2687+
unregister_chrdev(PPP_MAJOR, "ppp");
26892688
device_destroy(ppp_class, MKDEV(PPP_MAJOR, 0));
26902689
class_destroy(ppp_class);
26912690
}

‎sound/core/sound.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,7 @@ static void __exit alsa_sound_exit(void)
446446
{
447447
snd_info_minor_unregister();
448448
snd_info_done();
449-
if (unregister_chrdev(major, "alsa") != 0)
450-
snd_printk(KERN_ERR "unable to unregister major device number %d\n", major);
449+
unregister_chrdev(major, "alsa");
451450
}
452451

453452
module_init(alsa_sound_init)

0 commit comments

Comments
 (0)