From e5cdac9242f58ca0122822e8fd7cab03c7faeb07 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 25 Aug 2016 19:39:31 +0200 Subject: [PATCH] usb: storage: alauda: don't print on ENOMEM All kmalloc-based functions print enough information on failures. Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/alauda.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c index 1d8b03c..878b4b8 100644 --- a/drivers/usb/storage/alauda.c +++ b/drivers/usb/storage/alauda.c @@ -939,10 +939,8 @@ static int alauda_read_data(struct us_data *us, unsigned long address, len = min(sectors, blocksize) * (pagesize + 64); buffer = kmalloc(len, GFP_NOIO); - if (buffer == NULL) { - printk(KERN_WARNING "alauda_read_data: Out of memory\n"); + if (!buffer) return USB_STOR_TRANSPORT_ERROR; - } /* Figure out the initial LBA and page */ lba = address >> blockshift; @@ -1033,18 +1031,15 @@ static int alauda_write_data(struct us_data *us, unsigned long address, len = min(sectors, blocksize) * pagesize; buffer = kmalloc(len, GFP_NOIO); - if (buffer == NULL) { - printk(KERN_WARNING "alauda_write_data: Out of memory\n"); + if (!buffer) return USB_STOR_TRANSPORT_ERROR; - } /* * We also need a temporary block buffer, where we read in the old data, * overwrite parts with the new data, and manipulate the redundancy data */ blockbuffer = kmalloc((pagesize + 64) * blocksize, GFP_NOIO); - if (blockbuffer == NULL) { - printk(KERN_WARNING "alauda_write_data: Out of memory\n"); + if (!blockbuffer) { kfree(buffer); return USB_STOR_TRANSPORT_ERROR; } -- 2.7.4