From patchwork Mon Mar 13 20:50:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Patrik_Dahlstr=C3=B6m?= X-Patchwork-Id: 69131 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1409604wrd; Mon, 13 Mar 2023 14:12:17 -0700 (PDT) X-Google-Smtp-Source: AK7set+1KbgNkDojFG0P9N1AwpiyVIyAldj3d5s63MO1HifwLu3ibyX/PcqHkfuH2n+xYg39zigR X-Received: by 2002:a17:90b:4b44:b0:237:72e5:61bd with SMTP id mi4-20020a17090b4b4400b0023772e561bdmr37219175pjb.49.1678741937103; Mon, 13 Mar 2023 14:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678741937; cv=none; d=google.com; s=arc-20160816; b=CTLI2rMWN8JHNF1g3EBgcugQDk5+lWpRibzyiJOPAVCj691NleVxqUk8NBL9wzn7GN /wHMNUFqhmcYXUm1Ni6Vrzr+AigiiAlat4fq0TipkTyX93bTd8ipjwLGWYissY/MrnlD QNOH00Sr6WRcrPDy0cz1gkg9l0EiHBIey57YK99ur9TxNGP6FkKhv96XfgIMNR4/kAdW HpE/MNQPBagtiAtzLhePs8CqVxNw4xrluYFlpMbMx90x52mg/3CQ47+nwG6MIXygeDdD z8BC+VjDwzfWgWuDxuh3mWcodHKjUrsTk408MGO/g95OXcLmSLNN4D0g0gtVf/TF7PnZ YPtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=44n+TAkBaWHGhZd5jVqYIZZmjHKBgDRlsRmSjvMgBhg=; b=nzVqFCY2iAuQhAlJ/m+lDPaaOrTL3d7DpVLmh8ISrzJaecx+oZs9Hp87OGzq3Tvdu1 SjORcBHOUnWIW1vc3I7rAWSQuAPUU7FqyjAehADG8gor58KrcXMGq/CYG1gGS5qFeqw4 JNQIpXKNLvyfbuuUEYIUv2o9FoRMt2hsMalxHA0Q6OERaZBdepMKwGOowCdAEC2G9lno pyNFfzEsPJdRrMz98knWPow8Mj3omOBmx8wGg3NCvIS9uZ3oSkV5M2waE5w2RLcv3UYo qI7hHnTzLgFScnnn+00n04T3j/2c82nD8Tbers91870tUMw77wX3CrIhOWMn0vC6Z9C/ b84Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ge16-20020a17090b0e1000b0023a8d7dcb05si651510pjb.59.2023.03.13.14.12.04; Mon, 13 Mar 2023 14:12:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229896AbjCMU53 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 13 Mar 2023 16:57:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229516AbjCMU51 (ORCPT ); Mon, 13 Mar 2023 16:57:27 -0400 X-Greylist: delayed 402 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 13 Mar 2023 13:57:25 PDT Received: from ste-pvt-msa1.bahnhof.se (ste-pvt-msa1.bahnhof.se [213.80.101.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6402882364; Mon, 13 Mar 2023 13:57:24 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by ste-pvt-msa1.bahnhof.se (Postfix) with ESMTP id D7C1E3F3C3; Mon, 13 Mar 2023 21:50:39 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Score: -1.899 X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_05,RCVD_IN_DNSWL_LOW, SPF_FAIL,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 Received: from ste-pvt-msa1.bahnhof.se ([127.0.0.1]) by localhost (ste-pvt-msa1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CFHsA3PtJ1mI; Mon, 13 Mar 2023 21:50:39 +0100 (CET) Received: by ste-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id CD7213F380; Mon, 13 Mar 2023 21:50:38 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id 05E668E68A; Mon, 13 Mar 2023 20:50:38 +0000 (UTC) Received: from zimbra.dalakolonin.se ([127.0.0.1]) by localhost (zimbra.dalakolonin.se [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id sFmyATpvFeIT; Mon, 13 Mar 2023 20:50:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id 35D2B8E683; Mon, 13 Mar 2023 20:50:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at dalakolonin.se Received: from zimbra.dalakolonin.se ([127.0.0.1]) by localhost (zimbra.dalakolonin.se [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id UJ0ZAeiQBeJ8; Mon, 13 Mar 2023 20:50:36 +0000 (UTC) Received: from rack-server-1.dalakolonin.se (unknown [172.17.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTPSA id C98C08E680; Mon, 13 Mar 2023 20:50:36 +0000 (UTC) From: =?utf-8?q?Patrik_Dahlstr=C3=B6m?= To: jic23@kernel.org, lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, hns@goldelico.com Cc: =?utf-8?q?Patrik_Dahlstr=C3=B6m?= Subject: [PATCH] iio: adc: palmas_gpadc: fix NULL dereference on rmmod Date: Mon, 13 Mar 2023 21:50:29 +0100 Message-Id: <20230313205029.1881745-1-risca@dalakolonin.se> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760288504979180229?= X-GMAIL-MSGID: =?utf-8?q?1760288504979180229?= Calling dev_to_iio_dev() on a platform device pointer is undefined and will make adc NULL. Signed-off-by: Patrik Dahlström --- drivers/iio/adc/palmas_gpadc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c index 61e80bf3d05e..6db6f3bc768a 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c @@ -638,7 +638,7 @@ static int palmas_gpadc_probe(struct platform_device *pdev) static int palmas_gpadc_remove(struct platform_device *pdev) { - struct iio_dev *indio_dev = dev_to_iio_dev(&pdev->dev); + struct iio_dev *indio_dev = dev_get_drvdata(&pdev->dev); struct palmas_gpadc *adc = iio_priv(indio_dev); if (adc->wakeup1_enable || adc->wakeup2_enable)