From patchwork Fri Dec 15 11:17:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bourgoin X-Patchwork-Id: 179217 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9213549dys; Fri, 15 Dec 2023 03:56:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IEP1pUZXuQu8Tb8EX6TayS5bICtGh+EXSpT8t4V7CxWAWor+PVQNu4z/v67kV0ZK4YNGAg3 X-Received: by 2002:a05:6a20:1609:b0:18a:181b:146b with SMTP id l9-20020a056a20160900b0018a181b146bmr13924042pzj.29.1702641386676; Fri, 15 Dec 2023 03:56:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702641386; cv=none; d=google.com; s=arc-20160816; b=UxlgHx47+SxV/qhqhX8tCMl0xPMqsGBzTX/2wF+LRW+rxwkM9rbITKU249s7GBZT++ /CWfhTlyEo/hUwCK3RV/uh9wgCcAHhhi22/QhZOboupfqsb56t/uUJmT9Rk9PlY7tM8j j8xydefc8djtQ+dq4ScjJDjDnJ7t2yx/Td//12X53n7bjbLt8bPbqyJaSQugV9bHqtA0 m1fhpJi9DpEQc0kV0APdYGa/tRiGe/4BJnqD6s6h/oJxV3JHdw96nnTxBTHLHZXJsJTJ 5nSuSr4vwHuP+v/gCapok7HPUO8yIKhyiOXCDJb/tlu6SQZbzNDYE/uHX1DRZgIRII3N d4gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=EXThrm7r2Zne08IzRuM6iVKji7vFve1z4gpTqwOxd18=; fh=2Ocfh8oObV6XwDaQbZXmm0lCicccBNQW82OI4vXHf4w=; b=bcHu+da5e2BR9gnpdqvMADGYmFrMRuOVKqlG3TXBA+6Zn76chJSLD/lOphX+/vqkcI FyK7LPrWOdkF4TM8a1CwvC8BeeKYI1C+JDFmcQnZy2Vw6Q/SHKwXwEdaDKNrLyTkXSX/ fDW5mLa1rXKiqGSIYlAjeENfttNy+VVMiBBlhahzsJ8xXyyrfYo//MguKTKAcNGrZf34 xfK0GE/aqvIz2+ldVVV12CI4HQlwKJ6KtGbbAozvwcEEjSUhXjzpJ6IsqyPRp3kjm3HO aNjxwMeF+wH7k/MtjfivZClYAoaF3tr9PAZ0kw+W9USlrlTpFbbDlB98zJPIqTOtzpx8 czMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b="t3tBdg/M"; spf=pass (google.com: domain of linux-kernel+bounces-882-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-882-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id az14-20020a17090b028e00b00286596c9b37si2269102pjb.22.2023.12.15.03.56.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 03:56:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-882-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b="t3tBdg/M"; spf=pass (google.com: domain of linux-kernel+bounces-882-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-882-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2E3DCB22C38 for ; Fri, 15 Dec 2023 11:55:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C48B72DB69; Fri, 15 Dec 2023 11:55:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="t3tBdg/M" X-Original-To: linux-kernel@vger.kernel.org Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2B6A2C86C; Fri, 15 Dec 2023 11:55:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3BF9ZBLs018517; Fri, 15 Dec 2023 12:19:09 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=selector1; bh=EXThrm7 r2Zne08IzRuM6iVKji7vFve1z4gpTqwOxd18=; b=t3tBdg/MiCqNpIB6GCXwL6f qqDNiklz9eMqXuU9dl5VPKlFmYelJDismj312Je3vlnb0KEzNrswuJUUl37MMLdo 2Mqm43NdHvPSS+dzfWekfrr5RBdNMOs0RKigVLFWAvk0OSNLp2hHPUcyfCxmD2ay unEEVAIM5Na4dXhl8J1XHJB1dAWt1vAVMKnHNNYjpXIUX1McwH1334eZszuouoeQ wBfg5r5wZgSKW1ZHUyT81l5RrsBXpj16zGMQGHSrvmeIdhcsqOGqdewC7xPAa64A zzFB1W50hQjGPoYiJRom3mmjKaW5cYC0TP9J4PtmpEZWMWqFpD4zOi9oIjVnRFg= = Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3uyb2k9ec1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 12:19:08 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9BED4100052; Fri, 15 Dec 2023 12:19:04 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 618EE2138D7; Fri, 15 Dec 2023 12:19:04 +0100 (CET) Received: from localhost (10.201.20.61) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 15 Dec 2023 12:19:04 +0100 From: Thomas Bourgoin To: Herbert Xu , "David S . Miller" , Maxime Coquelin , Alexandre Torgue , Dan Carpenter CC: , , , , Thomas Bourgoin , kernel test robot Subject: [PATCH] crypto: stm32/crc32 - fix parsing list of devices Date: Fri, 15 Dec 2023 12:17:24 +0100 Message-ID: <20231215111724.864051-1-thomas.bourgoin@foss.st.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-15_06,2023-12-14_01,2023-05-22_02 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785348894742435411 X-GMAIL-MSGID: 1785348894742435411 smatch warnings: drivers/crypto/stm32/stm32-crc32.c:108 stm32_crc_get_next_crc() warn: can 'crc' even be NULL? Use list_first_entry_or_null instead of list_first_entry to retrieve the first device registered. The function list_first_entry always return a non NULL pointer even if the list is empty. Hence checking if the pointer returned is NULL does not tell if the list is empty or not. Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202311281111.ou2oUL2i-lkp@intel.com/ Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202311281111.ou2oUL2i-lkp@intel.com/ Signed-off-by: Thomas Bourgoin --- drivers/crypto/stm32/stm32-crc32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/stm32/stm32-crc32.c b/drivers/crypto/stm32/stm32-crc32.c index b2d5c8921ab3..b0cf6d2fd352 100644 --- a/drivers/crypto/stm32/stm32-crc32.c +++ b/drivers/crypto/stm32/stm32-crc32.c @@ -104,7 +104,7 @@ static struct stm32_crc *stm32_crc_get_next_crc(void) struct stm32_crc *crc; spin_lock_bh(&crc_list.lock); - crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list); + crc = list_first_entry_or_null(&crc_list.dev_list, struct stm32_crc, list); if (crc) list_move_tail(&crc->list, &crc_list.dev_list); spin_unlock_bh(&crc_list.lock);