From patchwork Mon Nov 22 14:38:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Moysan X-Patchwork-Id: 12693345 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A18C4C433F5 for ; Mon, 22 Nov 2021 14:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=XR4X7hnPzgxDuA3jD1LXHwozvQTil5q3X40IjbtbWTA=; b=mrr8Jc5UBjwq+S EHHwDqgJofaYMc0Qg9fkf0swFrK+UKA5OK/U/SBfGH7T6nPitYwHZq39BuRPi2j7zDGv6ENab19zA yyDnfMJrG93xKYlseC4KFVSKvaFINkh/+4ZqYXTX6f5oVTjLk7kpW3sqLhIm2MB/tcUCsAetMt3Ki VQ6NAE31yXEGLs3uojA16Musf7rcpJU+kDMqxFaz9lJupzSZcjs5ZfaBuEBpeWxSyF/0TeRfpBLEq FXHcgVB3w102Matp+bM4Qae7t/z+FTXcR9aLeq+opCgMw29wuF/VCVbo0kc7AiUcMc+Qhehlfocj7 LsIUD3ew3x/fVMbJNCHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpATk-00GtYx-Ft; Mon, 22 Nov 2021 14:39:32 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpATg-00GtY2-5a for linux-arm-kernel@lists.infradead.org; Mon, 22 Nov 2021 14:39:30 +0000 Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1AMDXEST003144; Mon, 22 Nov 2021 15:39:11 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=selector1; bh=qzuzXnps8uoSg/5ew9p+2cb+8oRWmDxyBUwVDf0JQFk=; b=LDLlWUJxqdFImWXoAb0qbfbYMpq+V6bq9Dg7wKPpgxsumRcp/g0c6ya59q3fe8IaiICB 06DBqVbrwvXKZ/9j8inUeBB/P1E+ohezfv5DCPxNN8K8qFNF5bMnfxJLC4P5Sepsiz0b 6GoDetiSly76xNjt0A+Rrcwp2ZTQAJvaVR8ZiqosIb+wVu7a/da+4ko+lM/UqSWRjjZ8 02P3supEAj95/PdGiCsQ0bqQd1SZAkiEOaQIj2A8ylxj+TQaoS4X8naaDxFYDaV+xsWS re07pz3h6c/6d7fg7ihLeeJreEvEiAf4QTdIgC8TMD5tFUD9i/RVsR1uNYfrWM9G2v2c Bg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3cgc6p0c2y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 Nov 2021 15:39:11 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3C00B10002A; Mon, 22 Nov 2021 15:39:08 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 3276821AAAC; Mon, 22 Nov 2021 15:39:08 +0100 (CET) Received: from localhost (10.75.127.47) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.26; Mon, 22 Nov 2021 15:39:07 +0100 From: Olivier Moysan To: Ahmad Fatoum , Alexandre Torgue , Fabrice Gasnier , Jonathan Cameron , Lars-Peter Clausen , Maxime Coquelin , Olivier Moysan , Wan Jiabing , Xu Wang CC: , , , Subject: [PATCH v2] iio: adc: stm32: fix null pointer on defer_probe error Date: Mon, 22 Nov 2021 15:38:09 +0100 Message-ID: <20211122143809.2332-1-olivier.moysan@foss.st.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-22_07,2021-11-22_02,2020-04-07_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211122_063929_014718_FA8865D0 X-CRM114-Status: GOOD ( 17.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org dev_err_probe() calls __device_set_deferred_probe_reason() on -EPROBE_DEFER error. If device pointer to driver core private structure is not initialized, an null pointer error occurs. This pointer is set on iio_device_register() call for iio device. dev_err_probe() must be called with the device which is probing. Replace iio device by its parent device. Fixes: 0e346b2cfa85 ("iio: adc: stm32-adc: add vrefint calibration support") Signed-off-by: Olivier Moysan Reviewed-by: Ahmad Fatoum --- Changes in v2: - Use parent device from indio_dev instead of private structure --- drivers/iio/adc/stm32-adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c index 7f1fb36c747c..341afdd342cc 100644 --- a/drivers/iio/adc/stm32-adc.c +++ b/drivers/iio/adc/stm32-adc.c @@ -1986,7 +1986,7 @@ static int stm32_adc_populate_int_ch(struct iio_dev *indio_dev, const char *ch_n /* Get calibration data for vrefint channel */ ret = nvmem_cell_read_u16(&indio_dev->dev, "vrefint", &vrefint); if (ret && ret != -ENOENT) { - return dev_err_probe(&indio_dev->dev, ret, + return dev_err_probe(indio_dev->dev.parent, ret, "nvmem access error\n"); } if (ret == -ENOENT)