aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorWolfram Sang <wsa-dev@sang-engineering.com>2016-08-25 13:39:14 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-30 13:17:38 -0400
commit29a99df17bb755bac716177295de7b4b86cb1467 (patch)
tree90889a1555dfaaefa2368c801f8758aa455be3de /drivers/usb
parente83c06e99df6de5a0ba9710280385a6da4084c76 (diff)
usb: misc: cytherm: 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')
-rw-r--r--drivers/usb/misc/cytherm.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c
index 9bab1a33bc16..9d8bb8dacdcd 100644
--- a/drivers/usb/misc/cytherm.c
+++ b/drivers/usb/misc/cytherm.c
@@ -101,10 +101,8 @@ static ssize_t set_brightness(struct device *dev, struct device_attribute *attr,
101 int retval; 101 int retval;
102 102
103 buffer = kmalloc(8, GFP_KERNEL); 103 buffer = kmalloc(8, GFP_KERNEL);
104 if (!buffer) { 104 if (!buffer)
105 dev_err(&cytherm->udev->dev, "out of memory\n");
106 return 0; 105 return 0;
107 }
108 106
109 cytherm->brightness = simple_strtoul(buf, NULL, 10); 107 cytherm->brightness = simple_strtoul(buf, NULL, 10);
110 108
@@ -148,10 +146,8 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *attr, char
148 int temp, sign; 146 int temp, sign;
149 147
150 buffer = kmalloc(8, GFP_KERNEL); 148 buffer = kmalloc(8, GFP_KERNEL);
151 if (!buffer) { 149 if (!buffer)
152 dev_err(&cytherm->udev->dev, "out of memory\n");
153 return 0; 150 return 0;
154 }
155 151
156 /* read temperature */ 152 /* read temperature */
157 retval = vendor_command(cytherm->udev, READ_RAM, TEMP, 0, buffer, 8); 153 retval = vendor_command(cytherm->udev, READ_RAM, TEMP, 0, buffer, 8);
@@ -192,10 +188,8 @@ static ssize_t show_button(struct device *dev, struct device_attribute *attr, ch
192 unsigned char *buffer; 188 unsigned char *buffer;
193 189
194 buffer = kmalloc(8, GFP_KERNEL); 190 buffer = kmalloc(8, GFP_KERNEL);
195 if (!buffer) { 191 if (!buffer)
196 dev_err(&cytherm->udev->dev, "out of memory\n");
197 return 0; 192 return 0;
198 }
199 193
200 /* check button */ 194 /* check button */
201 retval = vendor_command(cytherm->udev, READ_RAM, BUTTON, 0, buffer, 8); 195 retval = vendor_command(cytherm->udev, READ_RAM, BUTTON, 0, buffer, 8);
@@ -230,10 +224,8 @@ static ssize_t show_port0(struct device *dev, struct device_attribute *attr, cha
230 unsigned char *buffer; 224 unsigned char *buffer;
231 225
232 buffer = kmalloc(8, GFP_KERNEL); 226 buffer = kmalloc(8, GFP_KERNEL);
233 if (!buffer) { 227 if (!buffer)
234 dev_err(&cytherm->udev->dev, "out of memory\n");
235 return 0; 228 return 0;
236 }
237 229
238 retval = vendor_command(cytherm->udev, READ_PORT, 0, 0, buffer, 8); 230 retval = vendor_command(cytherm->udev, READ_PORT, 0, 0, buffer, 8);
239 if (retval) 231 if (retval)
@@ -257,10 +249,8 @@ static ssize_t set_port0(struct device *dev, struct device_attribute *attr, cons
257 int tmp; 249 int tmp;
258 250
259 buffer = kmalloc(8, GFP_KERNEL); 251 buffer = kmalloc(8, GFP_KERNEL);
260 if (!buffer) { 252 if (!buffer)
261 dev_err(&cytherm->udev->dev, "out of memory\n");
262 return 0; 253 return 0;
263 }
264 254
265 tmp = simple_strtoul(buf, NULL, 10); 255 tmp = simple_strtoul(buf, NULL, 10);
266 256
@@ -290,10 +280,8 @@ static ssize_t show_port1(struct device *dev, struct device_attribute *attr, cha
290 unsigned char *buffer; 280 unsigned char *buffer;
291 281
292 buffer = kmalloc(8, GFP_KERNEL); 282 buffer = kmalloc(8, GFP_KERNEL);
293 if (!buffer) { 283 if (!buffer)
294 dev_err(&cytherm->udev->dev, "out of memory\n");
295 return 0; 284 return 0;
296 }
297 285
298 retval = vendor_command(cytherm->udev, READ_PORT, 1, 0, buffer, 8); 286 retval = vendor_command(cytherm->udev, READ_PORT, 1, 0, buffer, 8);
299 if (retval) 287 if (retval)
@@ -317,10 +305,8 @@ static ssize_t set_port1(struct device *dev, struct device_attribute *attr, cons
317 int tmp; 305 int tmp;
318 306
319 buffer = kmalloc(8, GFP_KERNEL); 307 buffer = kmalloc(8, GFP_KERNEL);
320 if (!buffer) { 308 if (!buffer)
321 dev_err(&cytherm->udev->dev, "out of memory\n");
322 return 0; 309 return 0;
323 }
324 310
325 tmp = simple_strtoul(buf, NULL, 10); 311 tmp = simple_strtoul(buf, NULL, 10);
326 312
@@ -351,10 +337,8 @@ static int cytherm_probe(struct usb_interface *interface,
351 int retval = -ENOMEM; 337 int retval = -ENOMEM;
352 338
353 dev = kzalloc (sizeof(struct usb_cytherm), GFP_KERNEL); 339 dev = kzalloc (sizeof(struct usb_cytherm), GFP_KERNEL);
354 if (dev == NULL) { 340 if (!dev)
355 dev_err (&interface->dev, "Out of memory\n");
356 goto error_mem; 341 goto error_mem;
357 }
358 342
359 dev->udev = usb_get_dev(udev); 343 dev->udev = usb_get_dev(udev);
360 344