Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp670211pxb; Tue, 5 Apr 2022 18:06:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVyXVCQ6tg/8Zei4Fy9Lqm/KE2o/01jUSlncJ7YhJH+aTdcQXFZMlHzb2BFrViFPUjMSkt X-Received: by 2002:a05:6402:348b:b0:419:172c:e2aa with SMTP id v11-20020a056402348b00b00419172ce2aamr6290611edc.261.1649207176149; Tue, 05 Apr 2022 18:06:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649207176; cv=none; d=google.com; s=arc-20160816; b=tn5PJP0aGSFBrfrn7zLy5XMkJMWmNIBn08kmWq7Cdf9K9DnUkHdYKvSyEFfqGo1hck MDj1IOHU1wwfVjflNMx0+ZlObv8iiZqcUy2S0F6nXH62mMrPafL854BJMpazukRTH5FV i/ep8rJjJYPNc6qc41NIJy5aTgRZhomjL+tXWTMOYjx5byPDhmr3T4BoGZh7ZB/uqRnw py3fIbSNUuGU4kRiNDnGypsKv0iYZ+9a2cov1tJzHIIFwj7/zwTPkFLDW0c/DLpnLmFX n9Z98n2DmS6AsC4FA9H86FZSj4WQrq2HE6o4JFN8jAAvgsIoIuJ0XrJ5kkGQwCiyaDYD 1Z3g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QVxyswadvl0vhe8bcZF/8EQ5hG5W+AzxcB+SevfyuDE=; b=BttC0r6xdElagF8Nh36Hj03MtgzCsatVDmRO1RdQKCTtqLaDmrFX7H0MbRUO7S+pnc Ud05Kt6pJFTcVCocX960r7eVXKLXDtbp4Q1H71wJblwxivij/B82vnuduMQAVRwY+4MA TPOHHXzSpiZtBkwVOBstbp2R4BSqvOGTaA5yNJKue4L2uzz9a6QKtcPJCDGhNlZ0UYtQ qdGIlcFrV1RhxdRuNC4A82YACbOzQD+MlJ3DSKt9mS7sGwplaXvH58bQjk+xW7hI2mSu mlkLnXFXqYLeyGNSBNsCnmG6Ct58Ywabfn2SR1EufCnBIjQzpymqprWq3e8NniKlZ+vQ sQ+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aj9+VWZp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k10-20020a17090646ca00b006df76385d9csi8847233ejs.572.2022.04.05.18.05.50; Tue, 05 Apr 2022 18:06:16 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aj9+VWZp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383010AbiDEMRp (ORCPT + 99 others); Tue, 5 Apr 2022 08:17:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244973AbiDEIww (ORCPT ); Tue, 5 Apr 2022 04:52:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 805451CFFB; Tue, 5 Apr 2022 01:48:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C9A660FFC; Tue, 5 Apr 2022 08:48:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31986C385A1; Tue, 5 Apr 2022 08:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148498; bh=kTf509aGxUC2L+Qqne7LOHBXyNCvMcSwY5mKQwAKabs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aj9+VWZpxB8NdjuLlKU9mVsGJJ1W6QrX5kmtUW6qV5RZWQrmLNMCbk123Z01jgjvj MgZcOaffFJNJjLKM7AP2aVswfS3Fv41MBnRIXRONgJzcsPIt9czNgyPoum6mXYT0ro b2/QFgXoA5Ck9bCFp7pyRrRX5KFQYyWCOqWuqlVk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakob Koschel , Hans Verkuil , Sasha Levin Subject: [PATCH 5.16 0376/1017] media: saa7134: fix incorrect use to determine if list is empty Date: Tue, 5 Apr 2022 09:21:29 +0200 Message-Id: <20220405070405.447370620@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 From: Jakob Koschel [ Upstream commit 9f1f4b642451d35667a4dc6a9c0a89d954b530a3 ] 'dev' will *always* be set by list_for_each_entry(). It is incorrect to assume that the iterator value will be NULL if the list is empty. Instead of checking the pointer it should be checked if the list is empty. Fixes: 79dd0c69f05f ("V4L: 925: saa7134 alsa is now a standalone module") Signed-off-by: Jakob Koschel Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/pci/saa7134/saa7134-alsa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c b/drivers/media/pci/saa7134/saa7134-alsa.c index fb24d2ed3621..d3cde05a6eba 100644 --- a/drivers/media/pci/saa7134/saa7134-alsa.c +++ b/drivers/media/pci/saa7134/saa7134-alsa.c @@ -1214,7 +1214,7 @@ static int alsa_device_exit(struct saa7134_dev *dev) static int saa7134_alsa_init(void) { - struct saa7134_dev *dev = NULL; + struct saa7134_dev *dev; saa7134_dmasound_init = alsa_device_init; saa7134_dmasound_exit = alsa_device_exit; @@ -1229,7 +1229,7 @@ static int saa7134_alsa_init(void) alsa_device_init(dev); } - if (dev == NULL) + if (list_empty(&saa7134_devlist)) pr_info("saa7134 ALSA: no saa7134 cards found\n"); return 0; -- 2.34.1