From patchwork Tue Aug 23 20:19:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 12952579 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 DD895C32789 for ; Tue, 23 Aug 2022 20:37:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232097AbiHWUhO (ORCPT ); Tue, 23 Aug 2022 16:37:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230311AbiHWUg7 (ORCPT ); Tue, 23 Aug 2022 16:36:59 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2075.outbound.protection.outlook.com [40.107.237.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEB25B63 for ; Tue, 23 Aug 2022 13:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FG78SP5x0Lt/6+6/vNvUFBnFI+FL/ws8goDC2gyBsyZ7RIwrFvRWinhxLxoE62olEUwFSaayRfB+PUWCCp7MQPNuXz4DlfZEcY4SyDqCPq/T+ie0FryfQcB8xokCgamngi2x++6CP8o3JQTqM/VSz3cU7/86Nk4EGhIGVxL1VDQMOU2rtHGomtF6caM//RDSP4mIq9cjY0FZw9uX1RIe74/2pSkZsFZw8bB8SQB6pCItuXrma3PK9HAjvYwxQTvos683ZqsRYSJ1vt0kqDmVIoKm+/03smRSpa24CBIhbeJp0uQzLcatEHOjLkfA9uyFaYY7+ZyFlKX+yR6Vabbk+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=01XDffCwQawe3F3dkuiqniUxGZps5+4y5ipOOJLcrLk=; b=aeMIov0SGimwM3R0pb2rKgkGaB1U+av9oBG6AKsVLPfKJz0Gdl2vJWVJOEHvLbt5a/BN6IuM7X2vPnWhsSGlDrbU9Oc45OvAa3QVGzjkkAmjDzH020WdupNCST5+s+5UwShrjGjD5qOvJKxAj8E9I0Wrl27x0bmyNhhe3CwIdDACoqZ0xIv35XQCk0MgPalH6aMLxaHqijNUeIlvJO+bk2iI61dAouZF4wOhZOZhLPo4Qk8aBgAz1BXtRu//RPqG5vqub3lZhwuDle4WW551InQXAk+2ChpO82GU9K3AP3tpoHqI4G924yVf/ZcHS6RYHCqBgeEGYJDcAuZRz7gUaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=01XDffCwQawe3F3dkuiqniUxGZps5+4y5ipOOJLcrLk=; b=Shr6LOZQ9gonhS8FiAP9C5c97I7xL4ZruiyVK1bfRWHuS5TZts1jcwIuN/3t/dlSwwJAODCeN7RB7CsGbOFIT0IeC+Qu/Mm2QUrqLIdit1VvG/twnKpcra3qgjctnE0V+/ssvq0D71o1Ly153e8G6l4/YfkibCzYlLymR9gQqZxgBz1HQe4UuwESiZDVm7AuvfkMyVSSMCLTrn9rfWEqdDSzQkXgT1FjHX79ns1WGzZitcCbOpQ4pWKXQscj6RNUQbwgsWYVL8OTg+o8Eh2c7EMmef1GqD2c308RXsKV2yBKg7b07EHQ9zurlh68aWvCm/TzLlI6lWJU5JWtCrK0CQ== Received: from BN9PR03CA0935.namprd03.prod.outlook.com (2603:10b6:408:108::10) by MN2PR12MB3935.namprd12.prod.outlook.com (2603:10b6:208:168::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.14; Tue, 23 Aug 2022 20:20:04 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:108:cafe::76) by BN9PR03CA0935.outlook.office365.com (2603:10b6:408:108::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.22 via Frontend Transport; Tue, 23 Aug 2022 20:20:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5546.15 via Frontend Transport; Tue, 23 Aug 2022 20:20:03 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Tue, 23 Aug 2022 20:20:02 +0000 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Tue, 23 Aug 2022 13:20:01 -0700 From: Vadim Pasternak To: CC: , , "Vadim Pasternak" Subject: [PATCH platform 1/4] platform/mellanox: mlxreg-lc: Fix coverity warning Date: Tue, 23 Aug 2022 23:19:34 +0300 Message-ID: <20220823201937.46855-2-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220823201937.46855-1-vadimp@nvidia.com> References: <20220823201937.46855-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a52fb2b0-b5e8-4ace-1b92-08da8544dd0f X-MS-TrafficTypeDiagnostic: MN2PR12MB3935:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ogEZozwhr51V65lCh4EyLomNm7wf2E640c3Xpy2BgyplLPdvvsO3GDM9DSR0k0UhUgFM/wG9YfRoBVMJAyFK149iKptfXphu13Mtb4ITbs/+rkOqlb1t+gOWIQOaz31ylj9Cc/EKDvNkVmgn+OQ6VrKyvA9Wv5U2a0PlGVfqJp2ZlXN/DvAzG6LH/DKvcARcZvmhk+YSQvFj8cJJZ5lQ5W8oRVOu/SRdMV7psfRlkhbJR6zc6afhVYkRX+PEvgTzyxFFaVIn7xHClwRgg+jl116mOfQ/ap+wSoane2WMkIacWg0EUHb38ZPcyyZmDj1J74hGlvq5u8kE4A2zRCxJOVYCd8TghbrNuLFvdrntHeZ+e2+y6/C1l25iOxQ262vqyKhxSNHgDU0rP6FGwHAlcc1+kkQh0EgMZtdCj9J60sQyqXYTP2ql3JtHAbWEE0tmf5OzwA/Apc+Y0Hg9Z77o+qvSdI9/Q2ATkaDW/EnYFtp0S2gY2015PKfFXmkvyCWmkAvOMh9JTSUU9y7IiIhlemM9JAn5RJcQBOD/EBABl07zRYn/2Bk2olGVm6nTvwoMU2IjJ//GENyH97LHWekEZu6ixa+43vNaQM5GaS7+VztY/BKm1VCP0VSNsFspq8kM9OwAC8ITQm3KWcG08SkxESbSn9mwhAp16JW0JHBUMxJtdXx9bgcV0ZIGkwTD61gEiV3KBZFvmOLrIzER7/aDd5ZbsmCdrASpg612h6FKmwDMJkTjVmtLEhbffTeAE/fUOV1yyuUKOi+q55cR2jyN2xefbUGzzwOLdIL7yOZ3nQc= X-Forefront-Antispam-Report: CIP:12.22.5.235;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(396003)(346002)(39860400002)(376002)(136003)(46966006)(36840700001)(40470700004)(186003)(1076003)(16526019)(336012)(81166007)(356005)(36860700001)(47076005)(426003)(82740400003)(40460700003)(8936002)(83380400001)(5660300002)(70586007)(70206006)(8676002)(4326008)(82310400005)(40480700001)(4744005)(2906002)(6666004)(41300700001)(107886003)(26005)(54906003)(6916009)(316002)(478600001)(2616005)(86362001)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2022 20:20:03.7653 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a52fb2b0-b5e8-4ace-1b92-08da8544dd0f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.235];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3935 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Fix smatch warning: drivers/platform/mellanox/mlxreg-lc.c:866 mlxreg_lc_probe() warn: passing zero to 'PTR_ERR' by removing 'err = PTR_ERR(regmap)'. Fixes: b4b830a34d80 ("platform/mellanox: mlxreg-lc: Fix error flow and extend verbosity") Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Vadim Pasternak --- drivers/platform/mellanox/mlxreg-lc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/platform/mellanox/mlxreg-lc.c b/drivers/platform/mellanox/mlxreg-lc.c index 55834ccb4ac7..9a1bfcd24317 100644 --- a/drivers/platform/mellanox/mlxreg-lc.c +++ b/drivers/platform/mellanox/mlxreg-lc.c @@ -863,7 +863,6 @@ static int mlxreg_lc_probe(struct platform_device *pdev) if (err) { dev_err(&pdev->dev, "Failed to sync regmap for client %s at bus %d at addr 0x%02x\n", data->hpdev.brdinfo->type, data->hpdev.nr, data->hpdev.brdinfo->addr); - err = PTR_ERR(regmap); goto regcache_sync_fail; } From patchwork Tue Aug 23 20:19:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 12952582 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 77282C32772 for ; Tue, 23 Aug 2022 20:37:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231481AbiHWUhk (ORCPT ); Tue, 23 Aug 2022 16:37:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232260AbiHWUhQ (ORCPT ); Tue, 23 Aug 2022 16:37:16 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2072.outbound.protection.outlook.com [40.107.220.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2D4E4D274 for ; Tue, 23 Aug 2022 13:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mFyXFXawarku8mFnx4pdVtGFC9VmOx1kSAEG41Xa9mLDWhp/aEo8MUuUlWEeVf/R/uAmoTYj2cYPbha4j8TswJ6eGC6m49JXDztCZpwS3bDbYtC5F5M04A43Qq7JpXbQLu2KYVXhASxLKKDAEMFl6K7arYD18SQyCih6FwQasGV2H3cRleFctHHk4z/pq549VgxsMmw7vFQL6S9TFsieDOp7azEUQrOlRKMQpfIipXczt1i/2Wv5qznivslDX8vOdQ4I9vQXHTBplhxqi5h0kSk8QEzOqDdKcsqcmgaZuYTMDkKVdlPvdtlnsAEpBSHKZ+XdfzAs/LAkzoONwLYNug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KzBQDONeNvqLT9ncaCNppTQd4ueH/uLE64L728MJBJo=; b=hMMgVIgciQW0d/WqQ3sTHREKr4g2aXiSy0uQACo9w+xmFlSpLsoGayiGAUfCXZyBRjODqlmJlP0KsVCplXximeYQFQLEyskj7rGdjGsjp1Cqds5aYOlIh0cyGqYNsA7DCBBUvaD28tjXM7ddTaNrZ1vAk0JZTuzqX0GO6P7QqBBcVYVwvfoHhHo56sL2Dub64MVGA9o9P1Nu9KrvYZWHz48mik5fpW2tC4oEo10kJqI+Y6aps+l8gHp7jE9Aehz9KuPcJmiGJCYimvKsP1LdfiVVHYWrIXjTlEZiKlKBz4auOnkuTXXyKuRc273gFCJyqakgpoVZV+/bb0HjLZBIyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KzBQDONeNvqLT9ncaCNppTQd4ueH/uLE64L728MJBJo=; b=OS9oQF80N2AKpvXAf7JrNcyqd5N1gxpqe0GHQwpvgmsQBWTY9jkjG1xNi+BGdE8tXAhnsh+KZYjfx1aJTGi4LPLjqfipppvbuddLRQq5Vq2OMxBaSHP8N1NDLIN/1sIurADgbi22MhiPC3o0CYIj+6Q/EdntjwcTT7x0olVvRd16OTaBHgPC2wTpY4wE6ILameKe9aFKE3RwJ9I7MWQK6dJGkF/qRKRL+Sz4nTFnHJFTCfZ2lyD02OgElbfRrmc0MYp6yfds6wkadCt7Vgwv5fFhFqpAQ3r8RxoKs66x2cbjtvBB70tz60BJdB2ALt97RyAy9AF63y/DYxRDHDrm7g== Received: from MW4PR04CA0256.namprd04.prod.outlook.com (2603:10b6:303:88::21) by MN2PR12MB2863.namprd12.prod.outlook.com (2603:10b6:208:103::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.14; Tue, 23 Aug 2022 20:21:06 +0000 Received: from CO1NAM11FT019.eop-nam11.prod.protection.outlook.com (2603:10b6:303:88:cafe::69) by MW4PR04CA0256.outlook.office365.com (2603:10b6:303:88::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.14 via Frontend Transport; Tue, 23 Aug 2022 20:21:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.238) by CO1NAM11FT019.mail.protection.outlook.com (10.13.175.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5566.15 via Frontend Transport; Tue, 23 Aug 2022 20:21:06 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Tue, 23 Aug 2022 20:20:05 +0000 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Tue, 23 Aug 2022 13:20:03 -0700 From: Vadim Pasternak To: CC: , , "Vadim Pasternak" Subject: [PATCH platform 2/4] platform/mellanox: mlxreg-lc: Fix locking issue Date: Tue, 23 Aug 2022 23:19:35 +0300 Message-ID: <20220823201937.46855-3-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220823201937.46855-1-vadimp@nvidia.com> References: <20220823201937.46855-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: af032011-c657-4473-7975-08da85450277 X-MS-TrafficTypeDiagnostic: MN2PR12MB2863:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NwzQVrlwbhewjnUQhzvVANW1o6clA0Iscgrzmhnr9X+fkAPN+u1VRwFe9c6Fa0+oxfAPSd1DlUIw/Y/sRXiDlpmlcmFDlzR5s6tAEZVxNcnlAywl2yoJ8nVw8dhIK6RWPSjMkEq9Ysog3CRmWsG+e8+5mdh3eFd9WMq2okcqeQC2tQydq+yanAmDt4kZM7YVVad3Oz/BMzirZNrXkas8YQsqEkwuB7yRyxOFwO8OsOukXZ357QZ0WLaaLyLRdE3KYt7eYXpiHmx9lsENrgZ2CzqO5tOsfVoI3GTBLMYP1oKZ5DoEfN+bb7+7kd3aaY0y/6cUpJn6pzj5fxMBPMsgfWndyw4ovaRmvFQBxj1gGw5TDlnas+CSnirLd5isBlstk6OuaADlFzZGKHghvoUl5fP6Zc4k9Sl7+EQjryT29CbcCSDiVOzA9gPP1jHQkl5zHt+Li41SOpeg354KOJ4s/sfvonfW2Zy9LG5CDtrt2QqhTtx8A6vwCMtk116VAhdQmrS+k8HRvSBDk1YyblTwURCLIqz9S7O7efClR7wpJSUVWlNGYxReGmRz/bk0z886YjsjgN5y8tuMGt4p0hWKX1s+gE4kBIs+bUiSfarNWA5PLuqJtK/i+BL6iIdjn8YOSWFMLg2gV5I6uT8X59fUyY5lNHVe/ElBxLY5CSS0EQRY/gIbbZsWCoecokW81UmyIKRsLiOfI0tVDxgkXiISP5U70X7m/0iHLKLgulbxkDq6VfyYZ8Rlsz1Jg/DjGQbgG0mt3R6QNeJiqRJSlYpxQkUw9otDzi9TSqy2+tsagM6/B2XqeSB4ecHQGhJvkTWJ X-Forefront-Antispam-Report: CIP:12.22.5.238;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(136003)(39860400002)(376002)(396003)(346002)(36840700001)(46966006)(40470700004)(1076003)(186003)(356005)(16526019)(336012)(81166007)(2616005)(36860700001)(426003)(47076005)(5660300002)(82740400003)(40460700003)(8936002)(70586007)(70206006)(4326008)(83380400001)(8676002)(82310400005)(40480700001)(2906002)(6666004)(41300700001)(26005)(107886003)(6916009)(54906003)(316002)(86362001)(478600001)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2022 20:21:06.6030 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: af032011-c657-4473-7975-08da85450277 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.238];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT019.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2863 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Fix locking issues: - mlxreg_lc_state_update() takes a lock when set or clear "MLXREG_LC_POWERED". - All the devices can be deleted before MLXREG_LC_POWERED flag is cleared. To fix it: - Add lock() / unlock() at the beginning / end of mlxreg_lc_event_handler() and remove locking from mlxreg_lc_power_on_off() and mlxreg_lc_enable_disable() - Add locked version of mlxreg_lc_state_update() - mlxreg_lc_state_update_locked() for using outside mlxreg_lc_event_handler(). (2) Remove redundant NULL check for of if 'data->notifier'. Fixes: 62f9529b8d5c87b ("platform/mellanox: mlxreg-lc: Add initial support for Nvidia line card devices") Reported-by: Dan Carpenter Signed-off-by: Vadim Pasternak --- drivers/platform/mellanox/mlxreg-lc.c | 37 ++++++++++++++++++--------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/drivers/platform/mellanox/mlxreg-lc.c b/drivers/platform/mellanox/mlxreg-lc.c index 9a1bfcd24317..e578c7bc060b 100644 --- a/drivers/platform/mellanox/mlxreg-lc.c +++ b/drivers/platform/mellanox/mlxreg-lc.c @@ -460,8 +460,6 @@ static int mlxreg_lc_power_on_off(struct mlxreg_lc *mlxreg_lc, u8 action) u32 regval; int err; - mutex_lock(&mlxreg_lc->lock); - err = regmap_read(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_pwr, ®val); if (err) goto regmap_read_fail; @@ -474,7 +472,6 @@ static int mlxreg_lc_power_on_off(struct mlxreg_lc *mlxreg_lc, u8 action) err = regmap_write(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_pwr, regval); regmap_read_fail: - mutex_unlock(&mlxreg_lc->lock); return err; } @@ -491,8 +488,6 @@ static int mlxreg_lc_enable_disable(struct mlxreg_lc *mlxreg_lc, bool action) * line card which is already has been enabled. Disabling does not affect the disabled line * card. */ - mutex_lock(&mlxreg_lc->lock); - err = regmap_read(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_ena, ®val); if (err) goto regmap_read_fail; @@ -505,7 +500,6 @@ static int mlxreg_lc_enable_disable(struct mlxreg_lc *mlxreg_lc, bool action) err = regmap_write(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_ena, regval); regmap_read_fail: - mutex_unlock(&mlxreg_lc->lock); return err; } @@ -537,6 +531,15 @@ mlxreg_lc_sn4800_c16_config_init(struct mlxreg_lc *mlxreg_lc, void *regmap, static void mlxreg_lc_state_update(struct mlxreg_lc *mlxreg_lc, enum mlxreg_lc_state state, u8 action) +{ + if (action) + mlxreg_lc->state |= state; + else + mlxreg_lc->state &= ~state; +} + +static void +mlxreg_lc_state_update_locked(struct mlxreg_lc *mlxreg_lc, enum mlxreg_lc_state state, u8 action) { mutex_lock(&mlxreg_lc->lock); @@ -560,8 +563,11 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, dev_info(mlxreg_lc->dev, "linecard#%d state %d event kind %d action %d\n", mlxreg_lc->data->slot, mlxreg_lc->state, kind, action); - if (!(mlxreg_lc->state & MLXREG_LC_INITIALIZED)) + mutex_lock(&mlxreg_lc->lock); + if (!(mlxreg_lc->state & MLXREG_LC_INITIALIZED)) { + mutex_unlock(&mlxreg_lc->lock); return 0; + } switch (kind) { case MLXREG_HOTPLUG_LC_SYNCED: @@ -574,7 +580,7 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, if (!(mlxreg_lc->state & MLXREG_LC_POWERED) && action) { err = mlxreg_lc_power_on_off(mlxreg_lc, 1); if (err) - return err; + goto mlxreg_lc_power_on_off_fail; } /* In case line card is configured - enable it. */ if (mlxreg_lc->state & MLXREG_LC_CONFIGURED && action) @@ -588,12 +594,13 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, /* In case line card is configured - enable it. */ if (mlxreg_lc->state & MLXREG_LC_CONFIGURED) err = mlxreg_lc_enable_disable(mlxreg_lc, 1); + mutex_unlock(&mlxreg_lc->lock); return err; } err = mlxreg_lc_create_static_devices(mlxreg_lc, mlxreg_lc->main_devs, mlxreg_lc->main_devs_num); if (err) - return err; + goto mlxreg_lc_create_static_devices_fail; /* In case line card is already in ready state - enable it. */ if (mlxreg_lc->state & MLXREG_LC_CONFIGURED) @@ -620,6 +627,10 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, break; } +mlxreg_lc_power_on_off_fail: +mlxreg_lc_create_static_devices_fail: + mutex_unlock(&mlxreg_lc->lock); + return err; } @@ -665,7 +676,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent, if (err) goto mlxreg_lc_create_static_devices_failed; - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_POWERED, 1); + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_POWERED, 1); } /* Verify if line card is synchronized. */ @@ -676,7 +687,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent, /* Power on line card if necessary. */ if (regval & mlxreg_lc->data->mask) { mlxreg_lc->state |= MLXREG_LC_SYNCED; - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_SYNCED, 1); + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_SYNCED, 1); if (mlxreg_lc->state & ~MLXREG_LC_POWERED) { err = mlxreg_lc_power_on_off(mlxreg_lc, 1); if (err) @@ -684,7 +695,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent, } } - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_INITIALIZED, 1); + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_INITIALIZED, 1); return 0; @@ -904,6 +915,8 @@ static int mlxreg_lc_remove(struct platform_device *pdev) struct mlxreg_core_data *data = dev_get_platdata(&pdev->dev); struct mlxreg_lc *mlxreg_lc = platform_get_drvdata(pdev); + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_INITIALIZED, 0); + /* * Probing and removing are invoked by hotplug events raised upon line card insertion and * removing. If probing procedure fails all data is cleared. However, hotplug event still From patchwork Tue Aug 23 20:19:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 12952580 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 D411EC3F6B0 for ; Tue, 23 Aug 2022 20:37:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229766AbiHWUhP (ORCPT ); Tue, 23 Aug 2022 16:37:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231500AbiHWUhA (ORCPT ); Tue, 23 Aug 2022 16:37:00 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2077.outbound.protection.outlook.com [40.107.94.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5128356C0 for ; Tue, 23 Aug 2022 13:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pp5SXYhaQLgJuNSOZY6L43M3In/0gil33iPptzE5CTGEmt7o68qseA1p3P3cr0GC7ZV3rbRo9MtNE4pL7tyvufpx5bS7b0eLaA2gv+CUBEO+zu1ofeYib96h8QC3JlI/kiyaZZwr7Byflt0d1c7h6bXNpLH0rKiWMl/3Ui1JzDhMA0QayvG9efcX8bbaLnhURTUCVE3/FVgalhkq3gaKodgXPblmEqEPemKNtuxG6t5vCk5ZSFRMFEYlRc6bEDIJh1KF/LSKfp3vWpvOJSlNC0riczl/fXubhrSOv62bM8wdKHvdsWJv1H/1UARZufL5A9uCDx0s6oSW+zexEAiiBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TggDQH64bAIYx91GQeCjVAfJva7eMoliu6tfDUOiE+8=; b=glpwNwcKA43bFZGQApC404NgnJ77vGsNQimpFcv3nulEbOwQpiKFUKh7WubMOnl57R3YVnJ1qGDduXYm2HnYVsfrzw6Zy/7GH8ZT9n2QK4DqChVW0N0jDg+eFAC0ntJVVcPMnARNwMDwouRFyP7G4S+0Vf/mEqlC/QwkmxglCBV55Oc84L1IDMF5ODZNRAqUJkj+y4r0q3IOpAuTIBxFVo4jzE/oSaYWdYSlcFAUC/FXWP0HJKXoi7+QhQQPUGXeFawgtvNbdvg/TkagOgxtJK+BoUJDidvTAmxcWruurHeTNz9+x9D83s8ZYAiPvlYsy3HAzvQukOSKNo9H+Jf3eQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TggDQH64bAIYx91GQeCjVAfJva7eMoliu6tfDUOiE+8=; b=GPaLNEfTyZw9cVmcbuu48ArNJx2IPj3U9ets/XI8h9OV+ODKKCpeUXZf/ECNu8Gmy1IjKgud12PGknXeDAo38SslRRv3KrIhbJXrGZedPvzc8PH8hv2GoJyNw524e6pnEsTaRuMsePDBXGv4NlDJTl07budm9JJ9hZTANQP6Ot5XXyjuwU05mCURs5aMpF9n5tRDaumSahKKkesnoxRCTiOXW6DHla0qUGBDuPkbfIevp6BfMgY9+AJ3Hu23Oh3J/aKwI9rTTSZJRMPI7d7IJEp3VCowBDqRowlDqSgl81UEuLy5Hip8RIrl2ytyH3GxTlNmYt2qZ2TE3we53cBe9A== Received: from DS7PR07CA0021.namprd07.prod.outlook.com (2603:10b6:5:3af::23) by MN2PR12MB3744.namprd12.prod.outlook.com (2603:10b6:208:166::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.21; Tue, 23 Aug 2022 20:20:09 +0000 Received: from DM6NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3af:cafe::b0) by DS7PR07CA0021.outlook.office365.com (2603:10b6:5:3af::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.14 via Frontend Transport; Tue, 23 Aug 2022 20:20:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.236) by DM6NAM11FT004.mail.protection.outlook.com (10.13.172.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5566.15 via Frontend Transport; Tue, 23 Aug 2022 20:20:08 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Tue, 23 Aug 2022 20:20:08 +0000 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Tue, 23 Aug 2022 13:20:06 -0700 From: Vadim Pasternak To: CC: , , "Vadim Pasternak" Subject: [PATCH platform 3/4] platform/mellanox: Remove unnecessary code Date: Tue, 23 Aug 2022 23:19:36 +0300 Message-ID: <20220823201937.46855-4-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220823201937.46855-1-vadimp@nvidia.com> References: <20220823201937.46855-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e10eb762-8b93-4005-fa24-08da8544e004 X-MS-TrafficTypeDiagnostic: MN2PR12MB3744:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DwjMx8dhQd3/K1tC6vXTe9WJ4Niir9x6W4p/l/EbO8nXXoVtuwLmG0MLF7A3hnWC1BuM1aJVOyR8mS2dLbZJo6uwRhaSJ+HK+bPgBdWeGNQEJTD4V6BHSJkXoa9tCu9PP5j/b6ImzREFZqoD+A4Iti1iIi30UeT5xFXcsfxfK7GPC9NTIXTeZ0lBB9WSW6ZIZq1ulenKYy4ZuJ8ESsVkPU73UhtzRN8l7rY/hKovzvXBD3LLfdtRhezXf770tPd7Ar4wz+4gg/Q4/0Qfbhqxj//PgWOO9BK2AdnCsPe9maRhHBbOZ7xcRTEw2PE6JMl3ISOhHj5HEohP+xZErhHvKuG4GBUoMQ0owXfJk0Ikcaa6vZR9QjkA+GmPwS0Ce1RpUB+nqN3qH7yi5PlabH9CvUhcEOvdctOU7ID6QlM0/8qifZYCbDZ8LTw6qh40vOsgofux0/w4a7gymb0D8mBop7rZKglD8fTXjsKfpp+CVrQJUU679XqtthkT/QKKbzW9avAi4ZyT+XSCiEObGDruT08V4mPC31UGalE2/0h2CrUi5ZwkJN9nnUfWkcqByg9TYHPNyruXy171+Yqzo/yrKgdzJARl4/k9JA4PFcGNSHfrnrdDptM1qX/Oxq9MDVKycXvsNHEPu/ME+/wMo6E7Dee6IeoFUzLUQ0rr5EwYL2eoZcZn+6X7v/yVwfiuj0/Q999ZPhETrPrO4Pt9/TMJ2cUZDXciAAVcihGO+RnjkOEL5ImDT//7lh7Szumo38G4wl7WP2GmaZB0pad5lIvvLHD6J6Wzgl+TYfsjsq389lbyecsTalqxdqFL6j4kI8Jf X-Forefront-Antispam-Report: CIP:12.22.5.236;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(346002)(396003)(376002)(136003)(40470700004)(36840700001)(46966006)(86362001)(36860700001)(83380400001)(82740400003)(356005)(81166007)(40460700003)(6916009)(54906003)(316002)(8936002)(5660300002)(70586007)(70206006)(2616005)(8676002)(2906002)(4326008)(82310400005)(16526019)(47076005)(1076003)(478600001)(336012)(186003)(426003)(41300700001)(107886003)(40480700001)(26005)(6666004)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2022 20:20:08.7789 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e10eb762-8b93-4005-fa24-08da8544e004 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.236];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3744 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Remove redundant 'NULL' check for of if 'data->notifier'. Replace 'return err' by 'return 0' in mlxreg_lc_probe(). Fixes: 62f9529b8d5c87b ("platform/mellanox: mlxreg-lc: Add initial support for Nvidia line card devices") Reported-by: Dan Carpenter Signed-off-by: Vadim Pasternak --- drivers/platform/mellanox/mlxreg-lc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/platform/mellanox/mlxreg-lc.c b/drivers/platform/mellanox/mlxreg-lc.c index e578c7bc060b..1e0c3ddc46cd 100644 --- a/drivers/platform/mellanox/mlxreg-lc.c +++ b/drivers/platform/mellanox/mlxreg-lc.c @@ -825,10 +825,9 @@ static int mlxreg_lc_probe(struct platform_device *pdev) mutex_init(&mlxreg_lc->lock); /* Set event notification callback. */ - if (data->notifier) { - data->notifier->user_handler = mlxreg_lc_event_handler; - data->notifier->handle = mlxreg_lc; - } + data->notifier->user_handler = mlxreg_lc_event_handler; + data->notifier->handle = mlxreg_lc; + data->hpdev.adapter = i2c_get_adapter(data->hpdev.nr); if (!data->hpdev.adapter) { dev_err(&pdev->dev, "Failed to get adapter for bus %d\n", @@ -888,7 +887,7 @@ static int mlxreg_lc_probe(struct platform_device *pdev) if (err) goto mlxreg_lc_config_init_fail; - return err; + return 0; mlxreg_lc_config_init_fail: regcache_sync_fail: From patchwork Tue Aug 23 20:19:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 12952581 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 E12BFC32774 for ; Tue, 23 Aug 2022 20:37:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229839AbiHWUhT (ORCPT ); Tue, 23 Aug 2022 16:37:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230300AbiHWUhA (ORCPT ); Tue, 23 Aug 2022 16:37:00 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on20616.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5a::616]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C88313F0E for ; Tue, 23 Aug 2022 13:20:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n8CPEH6yoN8GhRajd8f2kqxegoqrFmqS8jQD/dCkGZKNmmE1+cUzWXcTv/P/iCzU3gHEH2+n+rydMmT2sOIWpTXjo7Gn3Nzxomj6OtUdaNJrUSAwqfsJI1VzpPl4ktO1fC3G5zDHEGuIxxAhAMaMRTcqKfL9epiYkR0hf0LVMJ2AXDjHEGm1WYJVy24OQWZTdIle1jy0rSuPTuGPu7pQqmzCJ5Pg1bc7scMIEoLmT1h+JjH9cdZXuMc9mm76hBmrNieCNnOSUQWX621plYntUq2/qUikT418TbLwo2w45C6dDvrbLpL9l/iqH7dfz1cLSQL6Tu8z4zYH5pDveZPAEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1N0wQnJ73TjmdjuW1TyRCRQNSuf0xFL+JeoB9ElYj6g=; b=i+haE3Jjuca5l0hBR5ynv3xl0v9gMos7zqZnBWh5MsOXCYuUxMNPAVTJjHuMxGs3VAB7hVQwRBjwpAPV4bOl7OEjDllQyroSj62Ua1BblLGEaSt58/huhf/Vhbsv9JV9dw2hOaKS9P4mis01Tlhw8pzBDarhEUodyisnscNZ+flSj8FiQySgDAcBYU/X/iOAQEbs4buFEja+n6KkumYE8uqUn+xXebL4l1u7tOrScFXRMH2yTg8xacVlFJXtWvwY73HsKkF1WDLVXlUDEKeWxwXovFfbhW6YNs9aIn1OA/tNW+kCef09rG/lkpHydDXxUwNOPA11hHogq76SPRNegQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1N0wQnJ73TjmdjuW1TyRCRQNSuf0xFL+JeoB9ElYj6g=; b=cYINd2S/lqtEdlSIe3vM8+5sxbKxyNgp809ds29tVPAXNd4i0BL8CJ22o+jnJp4lg+7MTCqjRY+/tahcudKSn3iAGGwK3Pgek6Sl004ilruzWr28Rx0kqNBHVXNyRG+RfKYkIwHD6C0I638A2fXueit3fg3CPxVhqohjoT9GYP5KS4NqLOg9VC3T6tCz1OpR2S1Pm0PtyLXLLKW2fRS/aKkH/E9eP4hnt5yIVtICHZmRbP9S1VSoGo3qRAnjJzoFYzYA8ywzhynzskt1PbVVX7QW/YkCiDI5+2m7s80BRwX9LsMFdMPd7jYk6Sc1CGgDvC8sfSNZm5FU2X6Dms+fDA== Received: from BN9PR03CA0539.namprd03.prod.outlook.com (2603:10b6:408:131::34) by MN2PR12MB4456.namprd12.prod.outlook.com (2603:10b6:208:266::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.20; Tue, 23 Aug 2022 20:20:14 +0000 Received: from BN8NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:408:131:cafe::61) by BN9PR03CA0539.outlook.office365.com (2603:10b6:408:131::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.14 via Frontend Transport; Tue, 23 Aug 2022 20:20:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by BN8NAM11FT025.mail.protection.outlook.com (10.13.177.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5566.15 via Frontend Transport; Tue, 23 Aug 2022 20:20:11 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Tue, 23 Aug 2022 20:20:11 +0000 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Tue, 23 Aug 2022 13:20:09 -0700 From: Vadim Pasternak To: CC: , , "Vadim Pasternak" Subject: [PATCH platform 4/4] platform/mellanox: Remove redundant 'NULL' check Date: Tue, 23 Aug 2022 23:19:37 +0300 Message-ID: <20220823201937.46855-5-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220823201937.46855-1-vadimp@nvidia.com> References: <20220823201937.46855-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1abcb22b-ab54-4ad0-5668-08da8544e16e X-MS-TrafficTypeDiagnostic: MN2PR12MB4456:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZA7wwCS+Xbf59kgdHr6iOSI2xpEF+CxU8sWDb2PBBej98RZjUlQQB5eLCxtcXmbH2sS2PHD7U/VkLNaNHQTe9Sd5bd7J8Y9UxR/MILxwwHiqL9Sgke6rL6l2Pp+44tbmUpmdWlu3ZMM/eqiYmqM2ZIBZpFs2VeYSdOvoi/eTbDGzq0aiM2Ze/QY8WRt29WfK9ns64xKCExWJXDrPVFlACNCm1YOrKy0ruwj4a1ceJiTp5Uo1zVKIWZ5Qj3S/tRStEBWwfngMoXZdijNC30NdESpBOakvyWwD06ydqb1+0IuKdJaYfRs8PmDNOuxpC6hb7G/vvp+foWn1hM2w88D00vA6VOUN+RNGC5v/qPcot5Y57ZtcZefDGQC6sBmG96ANfDSDL4txHC3JWE8EJi+2gPsxb3J9jgM24E6EpWTJhTX1UioWjooN6HvzFjPQ5wXb58suPaThuuLhOkGOdi95woYnj3pOWzu2HlNEP3KDNHC8eQA8S6+JCb9dx18IVsedCCuJRcOS0CRh/7oLxz38QfpyC3FG1zY1K8dPEWxLAGsAJMncsEWalTTCASluaZtHiMDTecV2Fu7XA1NURnQE9NO6eNAWp2vtduqoBqppkesW5VJAMgbwbewY0GW3/KILw61dQzMkWITrJr2J2vkyr4huytNR08mSoCrt+lvVZPukemuD9B9VsgXkac1Sjki07IJ6qdRbBa9CsVXwafQKpkpl2WeZgB3TeUIRySb3ZOl22+eGdy0YsN8M+ToIMqwgSAQwJmYC2/WaW6oQD9VEBgsPvQ7pg9+uzaPAZGeTT80= X-Forefront-Antispam-Report: CIP:12.22.5.235;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(376002)(396003)(346002)(136003)(36840700001)(40470700004)(46966006)(426003)(83380400001)(47076005)(8676002)(26005)(2616005)(16526019)(336012)(186003)(1076003)(2906002)(356005)(81166007)(40460700003)(82740400003)(36860700001)(86362001)(40480700001)(82310400005)(70206006)(41300700001)(70586007)(5660300002)(316002)(478600001)(6916009)(36756003)(54906003)(6666004)(107886003)(8936002)(4326008)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2022 20:20:11.0846 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1abcb22b-ab54-4ad0-5668-08da8544e16e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.235];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4456 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Remove 'NULL' check for 'data->hpdev.client' in error flow of mlxreg_lc_probe(). It cannot be 'NULL' at this point. Fixes: b4b830a34d80 ("platform/mellanox: mlxreg-lc: Fix error flow and extend verbosity") Reported-by: Dan Carpenter Signed-off-by: Vadim Pasternak --- drivers/platform/mellanox/mlxreg-lc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/mellanox/mlxreg-lc.c b/drivers/platform/mellanox/mlxreg-lc.c index 1e0c3ddc46cd..1e071df4c9f5 100644 --- a/drivers/platform/mellanox/mlxreg-lc.c +++ b/drivers/platform/mellanox/mlxreg-lc.c @@ -893,10 +893,8 @@ static int mlxreg_lc_probe(struct platform_device *pdev) regcache_sync_fail: regmap_write_fail: devm_regmap_init_i2c_fail: - if (data->hpdev.client) { - i2c_unregister_device(data->hpdev.client); - data->hpdev.client = NULL; - } + i2c_unregister_device(data->hpdev.client); + data->hpdev.client = NULL; i2c_new_device_fail: i2c_put_adapter(data->hpdev.adapter); data->hpdev.adapter = NULL;