From nobody Sun Feb 8 20:05:48 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9D22C77B7C for ; Thu, 4 May 2023 06:54:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229706AbjEDGyT (ORCPT ); Thu, 4 May 2023 02:54:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229819AbjEDGyH (ORCPT ); Thu, 4 May 2023 02:54:07 -0400 Received: from hust.edu.cn (unknown [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC91F30F2 for ; Wed, 3 May 2023 23:54:03 -0700 (PDT) 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 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 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 Content-Transfer-Encoding: quoted-printable X-FEAS-AUTH-USER: u202112092@hust.edu.cn Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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=20 device does not support any input methods in the=20 `snd_usb_caiaq_input_init` function. It returns an `-EINVAL` error code=20 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 Acked-by: Daniel Mack --- 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 *c= dev) =20 default: /* no input methods supported on this device */ + ret =3D -EINVAL; goto exit_free_idev; } =20 --=20 2.25.1