Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp44707lqr; Tue, 4 Jun 2024 20:28:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCURR9fU/+1LH6fiGEpjYzLvDymU0a+cq1rE4L5BFd47qtX3u8cdmyqG6zUcjD/uDYqiyttbXiB22hNlUlppkozW80ViQaahBV/C4ixAmg== X-Google-Smtp-Source: AGHT+IHHEmzIJfXw9ogQpeBxgjHREpPq+CASt/At8bwgxz8sxcks/QFrMovddhAGBGRMBT8qcR9e X-Received: by 2002:a17:907:1187:b0:a6a:44d9:7d15 with SMTP id a640c23a62f3a-a6a44d9810dmr16199866b.58.1717558109362; Tue, 04 Jun 2024 20:28:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717558109; cv=pass; d=google.com; s=arc-20160816; b=QlOiRIzwXqMLjNzdrnq95T8FsMfl0J2xt4qgAxcja6qTjZf7O+zm/PS46BomDax5u4 YsiSnKec7ipCvUAcuTmkoTlRxplyLsLjnTxQ9M9hk4WPLLooN8Jcb8YJtalyNSuSjTtS L6ybZo+3kNLaRvG9jNm27d7Q0FFoJ0N4nclloptt3CAjzsSkGwuUPRzSKdg1D1T49Z5U 6FW3UEpnnQI1hn2GgKrzSPH90uSt/sETXNVO0xAQzXXqz/hLtDIAeC4QFLdRTWlx/cet R1sE6I6pvOL8652bwiTqtwsKMsyslBJjSIi7oQohew9lLTAOP46IcyKZdmfhSLm0Xl2j MLxA== 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:message-id:date:subject:cc:to :from; bh=gZsblJE4Kt9QPy1g260c2P7G6CSiqEg+7jUueCWkQvQ=; fh=yh/xjS22szoW4J4w179yrWTg4VUmMJVNd/iEW8Uagoo=; b=zYHxGpeg06WB3dQ8JwkuWxhE2qEx1QgI1hkiprEj/p3S5ajxUSxuo9JJIqLRTXRGHS UyGMu4OJSbEP0ciBZ1onQyb6DV9Sq4pr7Bjx3H0smrykfJxk/TLKrQKhEhHiD3qDH2Vl PcZHy90N/wI1kwR6j1JZ87HsAXhA6qmUp824iGTVL2xrWWjCg0YpMRclNorHkv6UXFfc g4Sved0/ZoSk8MAyWoz/Icy7VMhhT12MUJTlFi2HC4pAaMvgZiI6w0ZUgBggPOE3QK4o 3ULyFmatgl8fO/3DBKGPf2LB7gmYRo3t8pCAoTPokTqpCYLF/hWmgp9EqbXZpJs3lbut KSYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=iscas.ac.cn); spf=pass (google.com: domain of linux-kernel+bounces-201721-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201721-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a69122bc867si249667366b.744.2024.06.04.20.28.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 20:28:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201721-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=iscas.ac.cn); spf=pass (google.com: domain of linux-kernel+bounces-201721-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201721-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0E2041F23E4A for ; Wed, 5 Jun 2024 03:28:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B9127345B; Wed, 5 Jun 2024 03:28:21 +0000 (UTC) Received: from cstnet.cn (smtp81.cstnet.cn [159.226.251.81]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 590C579DE; Wed, 5 Jun 2024 03:28:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717558100; cv=none; b=jspLuDEAciHReVVeWU/vr6wR2TxxMq6rZoFkrCZbaO46KncNmlwGYExGD5Cp0M5njpGZytjCU8M92XxNW0a4vDR890nEWz4l1z5be1Q+xzlXrUxTrZps1ajxYABsleWk51jKysvGSGQ5oozT7rmJSfkI7M58vDrFtz2MNZyLVKY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717558100; c=relaxed/simple; bh=AhHaZSHnGtq79rWfWTN2pKgAlYSGLJ0mpECqHrYgChc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Hqd4hAPLCqm0oNkQP4C7huzeuJYnL5SSnt8yuD+l7oBBgbTi/fj7J7yBYXzMFkT3xJ6/Hr8PVBmt/Nd/MSnsERJl6JuBjyhQTM0bHOUHsPZxo5OKiqbppQYZhViW8hJqTcwNbhOSKDR9JBN6AnOLvvtWTe6aAM9x51Ygocpv0zg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from localhost (unknown [124.16.138.129]) by APP-03 (Coremail) with SMTP id rQCowAB3mSZF219mfk9CDw--.26228S2; Wed, 05 Jun 2024 11:28:06 +0800 (CST) From: Chen Ni To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, vadimp@nvidia.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Chen Ni Subject: [PATCH] platform/mellanox: nvsw-sn2201: Add check for platform_device_add_resources Date: Wed, 5 Jun 2024 11:27:45 +0800 Message-Id: <20240605032745.2916183-1-nichen@iscas.ac.cn> 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 Content-Transfer-Encoding: 8bit X-CM-TRANSID:rQCowAB3mSZF219mfk9CDw--.26228S2 X-Coremail-Antispam: 1UD129KBjvJXoW7Kw15KFyfZw15Ww4rGw4UArb_yoW8GFWDpr yxua92kry7Gr4q93y7Ary3ZF15CayYvFWYqay3Aws3Zas8WFWDAr95tFyayrn2qryUGr18 Aw1xtr45ZFs3JaUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkv14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Cr 1j6rxdM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj 6xIIjxv20xvE14v26r1Y6r17McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr 0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkIecxEwVAFwVW8 GwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r 1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij 64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr 0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF 0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUxb18UUUUU= X-CM-SenderInfo: xqlfxv3q6l2u1dvotugofq/ Add check for the return value of platform_device_add_resources() and return the error if it fails in order to catch the error. Signed-off-by: Chen Ni --- drivers/platform/mellanox/nvsw-sn2201.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/platform/mellanox/nvsw-sn2201.c b/drivers/platform/mellanox/nvsw-sn2201.c index 3ef655591424..abe7be602f84 100644 --- a/drivers/platform/mellanox/nvsw-sn2201.c +++ b/drivers/platform/mellanox/nvsw-sn2201.c @@ -1198,6 +1198,7 @@ static int nvsw_sn2201_config_pre_init(struct nvsw_sn2201 *nvsw_sn2201) static int nvsw_sn2201_probe(struct platform_device *pdev) { struct nvsw_sn2201 *nvsw_sn2201; + int ret; nvsw_sn2201 = devm_kzalloc(&pdev->dev, sizeof(*nvsw_sn2201), GFP_KERNEL); if (!nvsw_sn2201) @@ -1205,8 +1206,10 @@ static int nvsw_sn2201_probe(struct platform_device *pdev) nvsw_sn2201->dev = &pdev->dev; platform_set_drvdata(pdev, nvsw_sn2201); - platform_device_add_resources(pdev, nvsw_sn2201_lpc_io_resources, + ret = platform_device_add_resources(pdev, nvsw_sn2201_lpc_io_resources, ARRAY_SIZE(nvsw_sn2201_lpc_io_resources)); + if (ret) + return ret; nvsw_sn2201->main_mux_deferred_nr = NVSW_SN2201_MAIN_MUX_DEFER_NR; nvsw_sn2201->main_mux_devs = nvsw_sn2201_main_mux_brdinfo; -- 2.25.1