Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm: remove md argument from specific_minor

The small patch below:
- Removes the unused md argument from both specific_minor() and next_free_minor()
- Folds kmalloc + memset(0) into a single kzalloc call in alloc_dev()

This has been compile tested on x86.

Signed-off-by: Frederik Deweerdt <frederik.deweerdt@gmail.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>

authored by

Frederik Deweerdt and committed by
Alasdair G Kergon
cf13ab8e 4fdfe401

+6 -8
+6 -8
drivers/md/dm.c
··· 924 924 /* 925 925 * See if the device with a specific minor # is free. 926 926 */ 927 - static int specific_minor(struct mapped_device *md, int minor) 927 + static int specific_minor(int minor) 928 928 { 929 929 int r, m; 930 930 ··· 957 957 return r; 958 958 } 959 959 960 - static int next_free_minor(struct mapped_device *md, int *minor) 960 + static int next_free_minor(int *minor) 961 961 { 962 962 int r, m; 963 963 ··· 968 968 spin_lock(&_minor_lock); 969 969 970 970 r = idr_get_new(&_minor_idr, MINOR_ALLOCED, &m); 971 - if (r) { 971 + if (r) 972 972 goto out; 973 - } 974 973 975 974 if (m >= (1 << MINORBITS)) { 976 975 idr_remove(&_minor_idr, m); ··· 992 993 static struct mapped_device *alloc_dev(int minor) 993 994 { 994 995 int r; 995 - struct mapped_device *md = kmalloc(sizeof(*md), GFP_KERNEL); 996 + struct mapped_device *md = kzalloc(sizeof(*md), GFP_KERNEL); 996 997 void *old_md; 997 998 998 999 if (!md) { ··· 1005 1006 1006 1007 /* get a minor number for the dev */ 1007 1008 if (minor == DM_ANY_MINOR) 1008 - r = next_free_minor(md, &minor); 1009 + r = next_free_minor(&minor); 1009 1010 else 1010 - r = specific_minor(md, minor); 1011 + r = specific_minor(minor); 1011 1012 if (r < 0) 1012 1013 goto bad_minor; 1013 1014 1014 - memset(md, 0, sizeof(*md)); 1015 1015 init_rwsem(&md->io_lock); 1016 1016 mutex_init(&md->suspend_lock); 1017 1017 spin_lock_init(&md->pushback_lock);