Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp1149426lqs; Wed, 6 Mar 2024 07:40:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW6kd9Ae7s5rnvbAviT5+A0QlumjQrAL7gJ8Thy9y7pI9V5yWZgzJ9bU0C5Mt+SnlmuhJYPfe6Tx2DmgkNzFNm70WiBfgZfK1XP2d7/4A== X-Google-Smtp-Source: AGHT+IG5KpD33OJd1VIVyoRODqJk2MyqK3i8WdkQiUzYugS1ddmnbKCHc/B+XSEgxN8FShQOpqQx X-Received: by 2002:a05:6808:118:b0:3c2:165e:1640 with SMTP id b24-20020a056808011800b003c2165e1640mr3504579oie.25.1709739622922; Wed, 06 Mar 2024 07:40:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709739622; cv=pass; d=google.com; s=arc-20160816; b=poAH26pp4XkIcW7nAmOxiJuC1J2SjvSxeQ711/Ncvaba9JOQwOlfxLxGCkpRVSyLIX yQ2mIxnzsXxa6lFW9ekJ7pljmHtdWmti80RGF+HVL4/6UIB2nbW0PNflerg3+8+IYECO gnklqd303ybnh83mL/Tq13aVsprvlpPNeVePMigIL/h4QI3c/bX10rF1RoTZ1lDrPBVY amrQj8NHBXhYJX/yQOi+RLcidX+vkcYNHEeRVyfQluVjpeXf8ChGOH7Oc6ZNdOlAc2zs Vu2HN7jv+vfTrQMeuOlaEn4fSdJLAymO0felabO9a8GTVwbcsMaJJ2ircX2WYVa2K3Nq ZlVg== ARC-Message-Signature: i=2; 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=raSfJXdch54wKIK4DRMWpE8eTeHn8ReCJV7fua2Sem4=; fh=b/TpPabogtP3B2Zw1MjNdzpC+hZcDNz2+x5B8clyugQ=; b=FconMHYVUOkmuCYrkcf9ke4UYxF8qnqK4/2UZEPIl5atIpCCOXgaET3/GfRo9i5mfM 99usMEP0pkWFudCYjI24Eo0xmitmHMau5qPN6f+S4mrPskzuExmm2IgkYzQtcWRVVgXi uax+o1xQbLUmXJ8pdlVYzsCbAMRwrl7ynhE+bNiw5rvMW+HY8w2ZUATySRgIzGaRn6JD TN8q3ROESZ5DdA4IrJD4VIGqW/+uSnA4U7pdL59s+aqRg8VMrD44qIxJCIpl+dY7pr/9 fEBI2MfOdWYTaKnbMXhBGkKb8DEGPc6NNePUZaCQfMXjpyHidh989MqJDm+IFv+v6OJ+ usgQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-94174-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94174-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s12-20020a63770c000000b005d8c1d4553bsi12288887pgc.894.2024.03.06.07.40.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 07:40:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94174-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-94174-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94174-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E86FA2887A6 for ; Wed, 6 Mar 2024 15:39:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 736B4135403; Wed, 6 Mar 2024 15:38:59 +0000 (UTC) Received: from mail-out.aladdin-rd.ru (mail-out.aladdin-rd.ru [91.199.251.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2A3C1353F2; Wed, 6 Mar 2024 15:38:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.199.251.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709739538; cv=none; b=nMQHxV+TpVcP+6Y5B+OXp/tBaanEasbxAg/XFAuUXYDF9uc7J46qXxZMbAnXEr4rS0NqR/ALot13OOvvSsJGbTfA7DKn/cZ+sh78poj+cWIe2pb1ckzE7prgU+l1Y6PlsgOcHYWmXBLx3NzcLtlZTSCoEVqAq+FE5R2YQWaq3KU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709739538; c=relaxed/simple; bh=mIrYgWybZIzzTmLvKcdEwm229Qxy6TkUJtHepPTkmW0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OF9X1R/1FbwykANr7kxC2r4pK/qDAzRg78+vZ3m9M6r7ogEw3We/ODwgd+vCsfGlZ3jMdA61fXg04yrxCsjT76IATO2n6l9e5eS8EO95h0qnrn4T4/LHZHG1UnwvAHnPOZh3nc8DG3V5DgsUjgTAler3CQzD2CHLbgAdjMxwKSQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru; spf=pass smtp.mailfrom=aladdin.ru; arc=none smtp.client-ip=91.199.251.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aladdin.ru From: Daniil Dulov To: Vadim Pasternak CC: Daniil Dulov , Mark Gross , Andy Shevchenko , Darren Hart , Hans de Goede , , , Subject: [PATCH] platform/mellanox: mlxreg-hotplug: Remove redundant NULL-check Date: Wed, 6 Mar 2024 18:38:04 +0300 Message-ID: <20240306153804.6509-1-d.dulov@aladdin.ru> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EXCH-2016-02.aladdin.ru (192.168.1.102) To EXCH-2016-01.aladdin.ru (192.168.1.101) Pointer item is checked fo NULL at mlxreg_hotplug_work_helper() and then it is dereferenced to produce dev_err(). This pointer is also dereferenced before calling this function and should never be NULL except some piece of hardware is broken as it is said in the comment before the check. So, this check can be safely removed. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: c6acad68eb2d ("platform/mellanox: mlxreg-hotplug: Modify to use a regmap interface") Signed-off-by: Daniil Dulov --- drivers/platform/mellanox/mlxreg-hotplug.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c index 5c022b258f91..0ce9fff1f7d4 100644 --- a/drivers/platform/mellanox/mlxreg-hotplug.c +++ b/drivers/platform/mellanox/mlxreg-hotplug.c @@ -348,20 +348,6 @@ mlxreg_hotplug_work_helper(struct mlxreg_hotplug_priv_data *priv, u32 regval, bit; int ret; - /* - * Validate if item related to received signal type is valid. - * It should never happen, excepted the situation when some - * piece of hardware is broken. In such situation just produce - * error message and return. Caller must continue to handle the - * signals from other devices if any. - */ - if (unlikely(!item)) { - dev_err(priv->dev, "False signal: at offset:mask 0x%02x:0x%02x.\n", - item->reg, item->mask); - - return; - } - /* Mask event. */ ret = regmap_write(priv->regmap, item->reg + MLXREG_HOTPLUG_MASK_OFF, 0); -- 2.25.1