From patchwork Thu May 4 06:50:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruliang Lin X-Patchwork-Id: 680241 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 321B2C77B73 for ; Mon, 8 May 2023 07:45:14 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 408E212AA; Mon, 8 May 2023 09:44:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 408E212AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1683531912; bh=YPv1Q0rzhbwS6Owc8R5ePJZQX211Tf9J18pUNWZlWqc=; h=From:To:Subject:Date:CC:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=jTiu9ssLYsmP4sRmwIkcny3m+6EmGFVtdK1Mj0EYJK74LGAFYAk2GcWQ1yZPtlDr7 MWLnS6FVqU/u+b3u0brdV2a6n7eXLeSxTSh4Gff8DFmeXE6cPRk5I+TSn69Qu3KG8l 9rnLHKZ0/J5lSxw2Gqwj5ByoeSzOuFUxRqfnamd8= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 08A30F8032D; Mon, 8 May 2023 09:43:57 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 044DEF8049E; Thu, 4 May 2023 08:52:03 +0200 (CEST) Received: from hust.edu.cn (unknown [202.114.0.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 23DC4F800EC for ; Thu, 4 May 2023 08:51:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 23DC4F800EC Received: from dd-virtual-machine.localdomain ([183.202.113.128]) (user=u202112092@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 3446pF6h014815-3446pF6i014815 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Thu, 4 May 2023 14:51:25 +0800 From: Ruliang Lin To: Daniel Mack , Jaroslav Kysela , Takashi Iwai , Karsten Wiese Subject: [PATCH] sound: caiaq: input: Add error handling for unsupported input methods in `snd_usb_caiaq_input_init` Date: Thu, 4 May 2023 14:50:53 +0800 Message-Id: <20230504065054.3309-1-u202112092@hust.edu.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-FEAS-AUTH-USER: u202112092@hust.edu.cn X-MailFrom: u202112092@hust.edu.cn X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: XIH5U7KNERTSEDIKFVHZ4HXXXDT4WLEY X-Message-ID-Hash: XIH5U7KNERTSEDIKFVHZ4HXXXDT4WLEY X-Mailman-Approved-At: Mon, 08 May 2023 07:43:53 +0000 CC: hust-os-kernel-patches@googlegroups.com, Ruliang Lin , Dongliang Mu , Daniel Mack , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Smatch complains that: snd_usb_caiaq_input_init() warn: missing error code 'ret' This patch adds a new case to handle the situation where the device does not support any input methods in the `snd_usb_caiaq_input_init` function. It returns an `-EINVAL` error code to indicate that no input methods are supported on the device. Fixes: 523f1dce3743 ("[ALSA] Add Native Instrument usb audio device support") Signed-off-by: Ruliang Lin Reviewed-by: Dongliang Mu --- The issue is found by static analyzer. The patched code has passed Smatch checker, but remains untested on real device. --- sound/usb/caiaq/input.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/usb/caiaq/input.c b/sound/usb/caiaq/input.c index 1e2cf2f08eec..84f26dce7f5d 100644 --- a/sound/usb/caiaq/input.c +++ b/sound/usb/caiaq/input.c @@ -804,6 +804,7 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *cdev) default: /* no input methods supported on this device */ + ret = -EINVAL; goto exit_free_idev; }