From patchwork Tue Feb 22 08:28:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Duszynski X-Patchwork-Id: 107932 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7EF07A0350; Tue, 22 Feb 2022 09:28:35 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 402F34114B; Tue, 22 Feb 2022 09:28:30 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id C4C1141148 for ; Tue, 22 Feb 2022 09:28:28 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 21LNv47j026019; Tue, 22 Feb 2022 00:28:28 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=vDOK5YCkzbGSv+ki4iKFNGp1vtikkHRZdrX28kXbJG8=; b=aqEpTIlxZFDwxqDMbrd7G1LJ88CTGVAb5sSB7mIv5DCojSRwV1wBh0aT3X/dfOht3T63 wUncJZ2rsgceF84amCDuJqR0vnkISXtwifdpz8+BIvmEEz5CMLHemplVFVhha2DrcfaP l4FsxXzwVLO/3vLzhNQFInnSXty/EJxizGh1chqkZYLcsilBuvXrpSIV3Vg68LzlY1CQ KrEcc7rWUSZZNUiFHEbXBPYz1WSt9MODyLyl4stYKfCHXWHZOYV2bzJ90dVO4Em6Tupm Vr+NyDrPuW7rxN0Ix1EbX1LibNsrO2IDm8XsU4gLKdK86J6f4OU3P6dWltP5+jSMoqcK nw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3echudt4dp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 22 Feb 2022 00:28:28 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 22 Feb 2022 00:28:25 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 22 Feb 2022 00:28:25 -0800 Received: from localhost.localdomain (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id 3D0CF3F7040; Tue, 22 Feb 2022 00:28:24 -0800 (PST) From: Tomasz Duszynski To: , Jakub Palider , Tomasz Duszynski CC: , Subject: [PATCH 2/2] raw/cnxk_gpio: check pointer before using it Date: Tue, 22 Feb 2022 09:28:17 +0100 Message-ID: <20220222082817.1057701-3-tduszynski@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220222082817.1057701-1-tduszynski@marvell.com> References: <20220222082817.1057701-1-tduszynski@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: sdJfRTCwnagnQvwnhYGyE391sSA4ifZk X-Proofpoint-GUID: sdJfRTCwnagnQvwnhYGyE391sSA4ifZk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-22_02,2022-02-21_02,2021-12-02_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Even though nonexistent cnxk_gpio is unlikely at this point it's a good practice to check pointers before using them. Fixes: 0e6557b448fa ("raw/cnxk_gpio: add self test") Coverity issue: 376502 Signed-off-by: Tomasz Duszynski Reviewed-by: Jerin Jacob Kollanukkaran --- drivers/raw/cnxk_gpio/cnxk_gpio_selftest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/raw/cnxk_gpio/cnxk_gpio_selftest.c b/drivers/raw/cnxk_gpio/cnxk_gpio_selftest.c index 7fccc48f30..acb65afa65 100644 --- a/drivers/raw/cnxk_gpio/cnxk_gpio_selftest.c +++ b/drivers/raw/cnxk_gpio/cnxk_gpio_selftest.c @@ -311,6 +311,8 @@ cnxk_gpio_selftest(uint16_t dev_id) int ret, ret2; rawdev = rte_rawdev_pmd_get_named_dev("cnxk_gpio"); + if (!rawdev) + return -ENODEV; gpiochip = rawdev->dev_private; queues = rte_rawdev_queue_count(dev_id);