Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753365AbbDEMQC (ORCPT ); Sun, 5 Apr 2015 08:16:02 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:21103 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753222AbbDEMOu (ORCPT ); Sun, 5 Apr 2015 08:14:50 -0400 X-IronPort-AV: E=Sophos;i="5.11,527,1422918000"; d="scan'208";a="108405223" From: Julia Lawall To: Jaroslav Kysela Cc: kernel-janitors@vger.kernel.org, Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/16] ALSA: au1x00: fix error return code Date: Sun, 5 Apr 2015 14:06:33 +0200 Message-Id: <1428235596-4757-14-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1428235596-4757-1-git-send-email-Julia.Lawall@lip6.fr> References: <1428235596-4757-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1655 Lines: 70 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/) // @@ 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; } // Signed-off-by: Julia Lawall --- 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), -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/