aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2009-12-09 08:23:32 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-23 14:34:10 -0500
commitff3b968ceeb73c037cf4759d21923943970f9a7a (patch)
treef45c5dbe56edaaba3a32c4a479910d721d25cbd9 /drivers
parentda307123c621b01cce147a4be313d8a754674f63 (diff)
USB: gadget: Use ERR_PTR/IS_ERR
Use ERR_PTR and IS_ERR rather than mixing integers and pointers. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression *E; @@ * E < 0 // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/f_audio.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/usb/gadget/f_audio.c b/drivers/usb/gadget/f_audio.c
index c43c89ffa2c8..0f2eee12ee9f 100644
--- a/drivers/usb/gadget/f_audio.c
+++ b/drivers/usb/gadget/f_audio.c
@@ -252,12 +252,12 @@ static struct f_audio_buf *f_audio_buffer_alloc(int buf_size)
252 252
253 copy_buf = kzalloc(sizeof *copy_buf, GFP_ATOMIC); 253 copy_buf = kzalloc(sizeof *copy_buf, GFP_ATOMIC);
254 if (!copy_buf) 254 if (!copy_buf)
255 return (struct f_audio_buf *)-ENOMEM; 255 return ERR_PTR(-ENOMEM);
256 256
257 copy_buf->buf = kzalloc(buf_size, GFP_ATOMIC); 257 copy_buf->buf = kzalloc(buf_size, GFP_ATOMIC);
258 if (!copy_buf->buf) { 258 if (!copy_buf->buf) {
259 kfree(copy_buf); 259 kfree(copy_buf);
260 return (struct f_audio_buf *)-ENOMEM; 260 return ERR_PTR(-ENOMEM);
261 } 261 }
262 262
263 return copy_buf; 263 return copy_buf;
@@ -332,7 +332,7 @@ static int f_audio_out_ep_complete(struct usb_ep *ep, struct usb_request *req)
332 list_add_tail(&copy_buf->list, &audio->play_queue); 332 list_add_tail(&copy_buf->list, &audio->play_queue);
333 schedule_work(&audio->playback_work); 333 schedule_work(&audio->playback_work);
334 copy_buf = f_audio_buffer_alloc(audio_buf_size); 334 copy_buf = f_audio_buffer_alloc(audio_buf_size);
335 if (copy_buf < 0) 335 if (IS_ERR(copy_buf))
336 return -ENOMEM; 336 return -ENOMEM;
337 } 337 }
338 338
@@ -576,6 +576,8 @@ static int f_audio_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
576 usb_ep_enable(out_ep, audio->out_desc); 576 usb_ep_enable(out_ep, audio->out_desc);
577 out_ep->driver_data = audio; 577 out_ep->driver_data = audio;
578 audio->copy_buf = f_audio_buffer_alloc(audio_buf_size); 578 audio->copy_buf = f_audio_buffer_alloc(audio_buf_size);
579 if (IS_ERR(audio->copy_buf))
580 return -ENOMEM;
579 581
580 /* 582 /*
581 * allocate a bunch of read buffers 583 * allocate a bunch of read buffers