From patchwork Tue Sep 22 15:37:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis de Bethencourt X-Patchwork-Id: 7250201 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 581BDBEEC1 for ; Wed, 23 Sep 2015 14:35:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A69320A82 for ; Wed, 23 Sep 2015 14:35:40 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 92ECD20A65 for ; Wed, 23 Sep 2015 14:35:39 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6A0A02659A9; Wed, 23 Sep 2015 16:35:32 +0200 (CEST) Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id B491226072A; Wed, 23 Sep 2015 16:33:48 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 07BB4264F22; Tue, 22 Sep 2015 17:38:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from lists.s-osg.org (lists.s-osg.org [54.187.51.154]) by alsa0.perex.cz (Postfix) with ESMTP id D2D54262626 for ; Tue, 22 Sep 2015 17:37:56 +0200 (CEST) Received: from localhost.localdomain (unknown [212.250.200.210]) by lists.s-osg.org (Postfix) with ESMTPSA id 2F1054632B; Tue, 22 Sep 2015 08:37:54 -0700 (PDT) From: Luis de Bethencourt To: linux-kernel@vger.kernel.org Date: Tue, 22 Sep 2015 16:37:37 +0100 Message-Id: <1442936257-8988-1-git-send-email-luisbg@osg.samsung.com> X-Mailer: git-send-email 2.5.3 X-Mailman-Approved-At: Wed, 23 Sep 2015 16:33:44 +0200 Cc: sudipm.mukherjee@gmail.com, alsa-devel@alsa-project.org, Luis de Bethencourt , tiwai@suse.com Subject: [alsa-devel] [PATCH] sound: oss: ad1848: Fix returned errno code in ad1848_init() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The driver is using -1 instead of the -ENOMEM defined macro to specify that a buffer allocation failed. Since the error number is propagated, the caller will get a -EPERM which is the wrong error condition. Smatch tool warning: ad1848_init() warn: returning -1 instead of -ENOMEM is sloppy Signed-off-by: Luis de Bethencourt --- sound/oss/ad1848.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c index 10c8de1..6b35656 100644 --- a/sound/oss/ad1848.c +++ b/sound/oss/ad1848.c @@ -1992,7 +1992,7 @@ int ad1848_init (char *name, struct resource *ports, int irq, int dma_playback, portc = kmalloc(sizeof(ad1848_port_info), GFP_KERNEL); if(portc==NULL) { release_region(devc->base, 4); - return -1; + return -ENOMEM; } if ((my_dev = sound_install_audiodrv(AUDIO_DRIVER_VERSION,