aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage
diff options
context:
space:
mode:
authorWolfram Sang <wsa-dev@sang-engineering.com>2016-08-25 13:39:32 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-30 13:17:39 -0400
commitfd233925ed2fa757cbea6478434fc219732974c9 (patch)
tree54c522d43352bd4698715a381ec25d59439dcc1c /drivers/usb/storage
parente5cdac9242f58ca0122822e8fd7cab03c7faeb07 (diff)
usb: storage: sddr09: don't print on ENOMEM
All kmalloc-based functions print enough information on failures. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r--drivers/usb/storage/sddr09.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
index c5797fa2125e..3aeaa536c44f 100644
--- a/drivers/usb/storage/sddr09.c
+++ b/drivers/usb/storage/sddr09.c
@@ -766,10 +766,8 @@ sddr09_read_data(struct us_data *us,
766 766
767 len = min(sectors, (unsigned int) info->blocksize) * info->pagesize; 767 len = min(sectors, (unsigned int) info->blocksize) * info->pagesize;
768 buffer = kmalloc(len, GFP_NOIO); 768 buffer = kmalloc(len, GFP_NOIO);
769 if (buffer == NULL) { 769 if (!buffer)
770 printk(KERN_WARNING "sddr09_read_data: Out of memory\n");
771 return -ENOMEM; 770 return -ENOMEM;
772 }
773 771
774 // This could be made much more efficient by checking for 772 // This could be made much more efficient by checking for
775 // contiguous LBA's. Another exercise left to the student. 773 // contiguous LBA's. Another exercise left to the student.
@@ -1004,10 +1002,8 @@ sddr09_write_data(struct us_data *us,
1004 pagelen = (1 << info->pageshift) + (1 << CONTROL_SHIFT); 1002 pagelen = (1 << info->pageshift) + (1 << CONTROL_SHIFT);
1005 blocklen = (pagelen << info->blockshift); 1003 blocklen = (pagelen << info->blockshift);
1006 blockbuffer = kmalloc(blocklen, GFP_NOIO); 1004 blockbuffer = kmalloc(blocklen, GFP_NOIO);
1007 if (!blockbuffer) { 1005 if (!blockbuffer)
1008 printk(KERN_WARNING "sddr09_write_data: Out of memory\n");
1009 return -ENOMEM; 1006 return -ENOMEM;
1010 }
1011 1007
1012 /* 1008 /*
1013 * Since we don't write the user data directly to the device, 1009 * Since we don't write the user data directly to the device,
@@ -1017,8 +1013,7 @@ sddr09_write_data(struct us_data *us,
1017 1013
1018 len = min(sectors, (unsigned int) info->blocksize) * info->pagesize; 1014 len = min(sectors, (unsigned int) info->blocksize) * info->pagesize;
1019 buffer = kmalloc(len, GFP_NOIO); 1015 buffer = kmalloc(len, GFP_NOIO);
1020 if (buffer == NULL) { 1016 if (!buffer) {
1021 printk(KERN_WARNING "sddr09_write_data: Out of memory\n");
1022 kfree(blockbuffer); 1017 kfree(blockbuffer);
1023 return -ENOMEM; 1018 return -ENOMEM;
1024 } 1019 }
@@ -1241,8 +1236,7 @@ sddr09_read_map(struct us_data *us) {
1241 alloc_blocks = min(numblocks, SDDR09_READ_MAP_BUFSZ >> CONTROL_SHIFT); 1236 alloc_blocks = min(numblocks, SDDR09_READ_MAP_BUFSZ >> CONTROL_SHIFT);
1242 alloc_len = (alloc_blocks << CONTROL_SHIFT); 1237 alloc_len = (alloc_blocks << CONTROL_SHIFT);
1243 buffer = kmalloc(alloc_len, GFP_NOIO); 1238 buffer = kmalloc(alloc_len, GFP_NOIO);
1244 if (buffer == NULL) { 1239 if (!buffer) {
1245 printk(KERN_WARNING "sddr09_read_map: out of memory\n");
1246 result = -1; 1240 result = -1;
1247 goto done; 1241 goto done;
1248 } 1242 }