summaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2021-05-12 22:36:12 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-05-17 16:54:01 +0200
commitb15fc7c2c88e7a97fa347446301c37272de20ed5 (patch)
tree5943f74ca5f61ee49c2734622beb3d06c10a4289 /drivers/pnp
parentdaadabfbd36d57a158623fa81585a4e9aa954c53 (diff)
downloadlinux-b15fc7c2c88e7a97fa347446301c37272de20ed5.tar.bz2
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>
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/base.h1
-rw-r--r--drivers/pnp/card.c2
-rw-r--r--drivers/pnp/core.c12
-rw-r--r--drivers/pnp/interface.c4
4 files changed, 3 insertions, 16 deletions
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
index cdcfa39cf167..e74a0f6a3157 100644
--- a/drivers/pnp/base.h
+++ b/drivers/pnp/base.h
@@ -6,7 +6,6 @@
extern struct mutex pnp_lock;
extern const struct attribute_group *pnp_dev_groups[];
-void *pnp_alloc(long size);
int pnp_register_protocol(struct pnp_protocol *protocol);
void pnp_unregister_protocol(struct pnp_protocol *protocol);
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index c2464ee08e4a..2430c14f472d 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -80,7 +80,7 @@ static int card_probe(struct pnp_card *card, struct pnp_card_driver *drv)
if (!id)
return 0;
- clink = pnp_alloc(sizeof(*clink));
+ clink = kzalloc(sizeof(*clink), GFP_KERNEL);
if (!clink)
return 0;
clink->card = card;
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index a50ab002e9e4..ccdfbf3978c0 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -31,18 +31,6 @@ DEFINE_MUTEX(pnp_lock);
int pnp_platform_devices;
EXPORT_SYMBOL(pnp_platform_devices);
-void *pnp_alloc(long size)
-{
- void *result;
-
- result = kzalloc(size, GFP_KERNEL);
- if (!result) {
- printk(KERN_ERR "pnp: Out of Memory\n");
- return NULL;
- }
- return result;
-}
-
static void pnp_remove_protocol(struct pnp_protocol *protocol)
{
mutex_lock(&pnp_lock);
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index 602c46893e83..44efcdb87e6f 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -214,7 +214,7 @@ static ssize_t options_show(struct device *dmdev, struct device_attribute *attr,
int ret, dep = 0, set = 0;
char *indent;
- buffer = pnp_alloc(sizeof(pnp_info_buffer_t));
+ buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
if (!buffer)
return -ENOMEM;
@@ -257,7 +257,7 @@ static ssize_t resources_show(struct device *dmdev,
if (!dev)
return -EINVAL;
- buffer = pnp_alloc(sizeof(pnp_info_buffer_t));
+ buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
if (!buffer)
return -ENOMEM;