Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp130101rwr; Thu, 4 May 2023 00:00:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6lEiMEYUyMR+emQAVDP1S9ovhy9vW8+4UnvU7YmHbs1fRAojJ1TmPjtFdMr9H1PXHFL+0V X-Received: by 2002:a17:902:ec8c:b0:1aa:f3c4:7582 with SMTP id x12-20020a170902ec8c00b001aaf3c47582mr3808785plg.31.1683183630793; Thu, 04 May 2023 00:00:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683183630; cv=none; d=google.com; s=arc-20160816; b=tesJjb2weIoF2ekZJpsDzaloK6Wcf0Na/ltP0B9ChtUH24WUk4i/z/AlncgyEF4DHK 7R4es8SBQ8dnbXPG5uzsZxtbJGifdXzbklVg5MHF3/850S+8VbA09wL4atQ1gXNWoMd6 izFK8jzjJ4jOM8qzZoII0BDMJ6XBRamA323cguyJWnjJklvjBybXxGOvIknlGp2t2ilQ UpJElNzWK7qgpCuypHkEHR72sA7dTsyVOiYGFx0crFpkx+fXvJM/t0JZWCVx4HD/j8zX 3F+xkjZDAjVBrL/toksyWjzJzmgEKOjq0/hookiQHukidCZiciLSz13AnbE5Eik5U3ZI ZFDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=e8Z0pAzzYD8Xg/k0ZJNRWoo1MnFU5HM+z4zZvdaR1+A=; b=BJ/FadMmB1tpOngrdvkaa9RoQRGrCweP5tUOOJ1+3ogrKLbreWJFpgkrnStV4ITXQM byD9Cmcr+mdfwZ1HxuADX6XBqtdPQsXlZGvzOtTOtOmaB1SjZFQ7VFSxR4WjrNxnGwnu 4rzGx1nOGkhIg2cjqyFxl/Z4ONp8aZs/5ooRRE/jao2QRCUACr1WxPPbi4xI8KJzXRpT d+GdlrNU4dM+hh7xQy4OTUn8zzS4Xqbb0ODA6WV56WYPkLXPwnBbmWqb8u9GsAup8ZgV JqlWkH90FzWYSUVK8pvzq2GJTRAqTvuT+s4sEtIBQ3qI63yilJ36VNBBCctDu0Cxj7gU h+Xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jb22-20020a170903259600b001a94429df88si29161028plb.123.2023.05.04.00.00.09; Thu, 04 May 2023 00:00:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230053AbjEDGyR (ORCPT + 99 others); Thu, 4 May 2023 02:54:17 -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: 8bit X-FEAS-AUTH-USER: u202112092@hust.edu.cn X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.25.1