Messages in this thread Patch in this message | | | From | Hans de Goede <> | Subject | [PATCH 3/3] misc: lis3lv02d: Do not log an error when kmalloc fails | Date | Wed, 17 Feb 2021 11:25:01 +0100 |
| |
Logging an error when kmalloc fails is not necessary (and in general should be avoided) because the malloc failure will already complain loudly itself.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/misc/lis3lv02d/lis3lv02d.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c index 22dacfaad02f..70c5bb1e6f49 100644 --- a/drivers/misc/lis3lv02d/lis3lv02d.c +++ b/drivers/misc/lis3lv02d/lis3lv02d.c @@ -1179,10 +1179,8 @@ int lis3lv02d_init_device(struct lis3lv02d *lis3) lis3->reg_cache = kzalloc(max(sizeof(lis3_wai8_regs), sizeof(lis3_wai12_regs)), GFP_KERNEL); - if (lis3->reg_cache == NULL) { - printk(KERN_ERR DRIVER_NAME "out of memory\n"); + if (lis3->reg_cache == NULL) return -ENOMEM; - } mutex_init(&lis3->mutex); atomic_set(&lis3->wake_thread, 0); -- 2.30.1
| |