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

PNP: Remove pnp_alloc()

The kernel will complain anyway if it runs out of memory, so it is
not necessary to print an extra error message when that happens and
kzalloc() can be called directly instead of pnp_alloc() which then
becomes redundant and can be dropped.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Heiner Kallweit and committed by
Rafael J. Wysocki
b15fc7c2 daadabfb

+3 -16
-1
drivers/pnp/base.h
··· 6 6 7 7 extern struct mutex pnp_lock; 8 8 extern const struct attribute_group *pnp_dev_groups[]; 9 - void *pnp_alloc(long size); 10 9 11 10 int pnp_register_protocol(struct pnp_protocol *protocol); 12 11 void pnp_unregister_protocol(struct pnp_protocol *protocol);
+1 -1
drivers/pnp/card.c
··· 80 80 if (!id) 81 81 return 0; 82 82 83 - clink = pnp_alloc(sizeof(*clink)); 83 + clink = kzalloc(sizeof(*clink), GFP_KERNEL); 84 84 if (!clink) 85 85 return 0; 86 86 clink->card = card;
-12
drivers/pnp/core.c
··· 31 31 int pnp_platform_devices; 32 32 EXPORT_SYMBOL(pnp_platform_devices); 33 33 34 - void *pnp_alloc(long size) 35 - { 36 - void *result; 37 - 38 - result = kzalloc(size, GFP_KERNEL); 39 - if (!result) { 40 - printk(KERN_ERR "pnp: Out of Memory\n"); 41 - return NULL; 42 - } 43 - return result; 44 - } 45 - 46 34 static void pnp_remove_protocol(struct pnp_protocol *protocol) 47 35 { 48 36 mutex_lock(&pnp_lock);
+2 -2
drivers/pnp/interface.c
··· 214 214 int ret, dep = 0, set = 0; 215 215 char *indent; 216 216 217 - buffer = pnp_alloc(sizeof(pnp_info_buffer_t)); 217 + buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); 218 218 if (!buffer) 219 219 return -ENOMEM; 220 220 ··· 257 257 if (!dev) 258 258 return -EINVAL; 259 259 260 - buffer = pnp_alloc(sizeof(pnp_info_buffer_t)); 260 + buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); 261 261 if (!buffer) 262 262 return -ENOMEM; 263 263