Message ID | 1428235596-4757-14-git-send-email-Julia.Lawall@lip6.fr (mailing list archive) |
---|---|
State | Accepted |
Commit | 646cb6dae4994eb332ddf7376520eed255c5a8b4 |
Headers | show |
At Sun, 5 Apr 2015 14:06:33 +0200, Julia Lawall wrote: > > Return a negative error code on failure. > > A simplified version of the semantic match that finds this problem is as > follows: (http://coccinelle.lip6.fr/) > > // <smpl> > @@ > identifier ret; expression e1,e2; > @@ > ( > if (\(ret < 0\|ret != 0\)) > { ... return ret; } > | > ret = 0 > ) > ... when != ret = e1 > when != &ret > *if(...) > { > ... when != ret = e2 > when forall > return ret; > } > // </smpl> > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Applied, thanks. Takashi > > --- > sound/mips/au1x00.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c > index fbcaa54..1e30e84 100644 > --- a/sound/mips/au1x00.c > +++ b/sound/mips/au1x00.c > @@ -633,19 +633,25 @@ static int au1000_ac97_probe(struct platform_device *pdev) > > au1000->stream[PLAYBACK] = kmalloc(sizeof(struct audio_stream), > GFP_KERNEL); > - if (!au1000->stream[PLAYBACK]) > + if (!au1000->stream[PLAYBACK]) { > + err = -ENOMEM; > goto out; > + } > au1000->stream[PLAYBACK]->dma = -1; > > au1000->stream[CAPTURE] = kmalloc(sizeof(struct audio_stream), > GFP_KERNEL); > - if (!au1000->stream[CAPTURE]) > + if (!au1000->stream[CAPTURE]) { > + err = -ENOMEM; > goto out; > + } > au1000->stream[CAPTURE]->dma = -1; > > r = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - if (!r) > + if (!r) { > + err = -ENODEV; > goto out; > + } > > err = -EBUSY; > au1000->ac97_res_port = request_mem_region(r->start, resource_size(r), > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel >
diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c index fbcaa54..1e30e84 100644 --- a/sound/mips/au1x00.c +++ b/sound/mips/au1x00.c @@ -633,19 +633,25 @@ static int au1000_ac97_probe(struct platform_device *pdev) au1000->stream[PLAYBACK] = kmalloc(sizeof(struct audio_stream), GFP_KERNEL); - if (!au1000->stream[PLAYBACK]) + if (!au1000->stream[PLAYBACK]) { + err = -ENOMEM; goto out; + } au1000->stream[PLAYBACK]->dma = -1; au1000->stream[CAPTURE] = kmalloc(sizeof(struct audio_stream), GFP_KERNEL); - if (!au1000->stream[CAPTURE]) + if (!au1000->stream[CAPTURE]) { + err = -ENOMEM; goto out; + } au1000->stream[CAPTURE]->dma = -1; r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!r) + if (!r) { + err = -ENODEV; goto out; + } err = -EBUSY; au1000->ac97_res_port = request_mem_region(r->start, resource_size(r),
Return a negative error code on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- sound/mips/au1x00.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)