Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2003553pxb; Thu, 7 Oct 2021 21:23:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmec8jcXZCVJN3+lHOtSdacKMmdb3WrJ9XFBBgUGOCXdy7rHMhshC04BTjvuv+VIamRkLq X-Received: by 2002:a17:902:b48d:b0:13e:8e7e:24d8 with SMTP id y13-20020a170902b48d00b0013e8e7e24d8mr7618842plr.55.1633667027755; Thu, 07 Oct 2021 21:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633667027; cv=none; d=google.com; s=arc-20160816; b=ozqRhIbwldNJusie0qa7hkZZly670EIUy7ZnvhQkI/EijLwXgcVLs0TyB43aIftSc6 mNYeg9TmQ4vWfz1KQ9e9ABApyrMsRszh7qMHX5wmEmXnWBu1j4qGXqEXyh8TtfZuh7lv gAatLY8hIO+g3ibRkadj8JyJfEnRKr+8st0xcRY9n/opwOCgcBmbvYgdlejRjubPST1p XrRqoB7JlAHSZJ5sOnQVS/Q7EMz+NMGGkxAXe15RlE4cbVHcAkODr7J0NVjo7Z3xMZjI sckqwEEJBbfICXnW83dbXgSzQ1Q/0/m2KZA8ll1oCBNMr3h7Wj8l+t4WDsulAExX9I4B CNPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=dXxoN2ru5dm3vOOb+2S6tznSapZlZe2lMTgkr5MCG7E=; b=z/1QQpXzfrQevxO48B7bQbI8HsJIdb6E/o+/65OJnAksNZ/eLvZg0hhjzto6urQVJ3 B75UGgehrZIXOObjMZ/9kmOYiqWsweuTl5JuBRAZuxEpOgVHY7Opji5vpVA9zhtNJozJ THxaawdfswuj/bDXXIYAV+g8oIbvy6MmJkFyOzgh6kzpJr/ZjmAcIRqDMqyz5fUKaDGD eC7Fsqm0LnaRF0nwYElX7RFCS0asEdsyPYKWZ2ewNX3EX5ZKlAIUkXxMwaJhraM6J7g+ lY3T2eE5ssQaI/+nDFB6cRQtiCwVFAwIqso8CAlWOi+5SRpYycHIbVmK9APsXEymRoyU i1Pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c197si1692734pga.616.2021.10.07.21.23.33; Thu, 07 Oct 2021 21:23:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241878AbhJHDXf (ORCPT + 99 others); Thu, 7 Oct 2021 23:23:35 -0400 Received: from smtp23.cstnet.cn ([159.226.251.23]:43508 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240622AbhJHDXQ (ORCPT ); Thu, 7 Oct 2021 23:23:16 -0400 Received: from localhost.localdomain (unknown [124.16.138.128]) by APP-03 (Coremail) with SMTP id rQCowAAXHKgduV9hWRC9Ag--.55152S2; Fri, 08 Oct 2021 11:21:01 +0800 (CST) From: Jiasheng Jiang To: lorenzo.bianconi83@gmail.com, jic23@kernel.org, lars@metafoo.de Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] io: imu: st_lsm6dsx: check if dev is null pointer Date: Fri, 8 Oct 2021 03:21:00 +0000 Message-Id: <1633663260-71997-1-git-send-email-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: rQCowAAXHKgduV9hWRC9Ag--.55152S2 X-Coremail-Antispam: 1UD129KBjv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ldfou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The parameter 'dev' of st_lsm6dsx_probe() isn't been checked before used, including when st_lsm6dsx_probe() is called. Therefore, it might be better to check, just in case. Fixes: 290a6ce ("iio: imu: add support to lsm6dsx driver") Signed-off-by: Jiasheng Jiang --- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c index 7cedaab..7b4754d 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c @@ -2199,6 +2199,8 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, const char *name = NULL; int i, err; + if (!dev) + return -ENOMEM; hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL); if (!hw) return -ENOMEM; -- 2.7.4