From nobody Wed Dec 17 11:39:36 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F560C77B73 for ; Thu, 20 Apr 2023 11:08:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235308AbjDTLIg (ORCPT ); Thu, 20 Apr 2023 07:08:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235336AbjDTLHS (ORCPT ); Thu, 20 Apr 2023 07:07:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 293E28A76; Thu, 20 Apr 2023 04:04:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A1476617EF; Thu, 20 Apr 2023 11:03:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35F8EC4339B; Thu, 20 Apr 2023 11:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681988638; bh=XGuQua3qFkKXR113AHzPtaUgmD0Q6HpJpVp/TOacGUs=; h=From:To:Cc:Subject:Date:From; b=E2R1D7ToCvn6SuLUYl+3G2iGiDY3BEPMjK0HV2U6VeAME9L13ChKIpWGWDo1WZsEe m23dtSHCImgncTyumz8zCQFQip4h1tE3CKnX5JOOJwRcH1Kvl5Exx7skx9Bnc64907 G1Om//e16UrZ+WY8iNbukwjUq6BQszlIOobuyuu/+tDz6wfbNjThVdOY5tPsGFkFhZ SME0K7kVCIPhA9EH7T8T/doj+VWe2h+56RRwSfVg0vF2tBvL0Wt2h070zDksvgVtY7 ChPeNmAw6SKYvZOtWInB4fJN+7fMhXj7B2YCzmr+Hemng44TRx4LjkkFMEUmzxPNic 8m/9OIYqPj2NA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Patrik=20Dahlstr=C3=B6m?= , Jonathan Cameron , Sasha Levin , jic23@kernel.org, linux-iio@vger.kernel.org Subject: [PATCH AUTOSEL 4.14] iio: adc: palmas_gpadc: fix NULL dereference on rmmod Date: Thu, 20 Apr 2023 07:03:53 -0400 Message-Id: <20230420110355.506432-1-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Patrik Dahlstr=C3=B6m [ Upstream commit 49f76c499d38bf67803438eee88c8300d0f6ce09 ] Calling dev_to_iio_dev() on a platform device pointer is undefined and will make adc NULL. Signed-off-by: Patrik Dahlstr=C3=B6m Link: https://lore.kernel.org/r/20230313205029.1881745-1-risca@dalakolonin.= se Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- 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 f5218461ae255..f422df4daadcb 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c @@ -634,7 +634,7 @@ static int palmas_gpadc_probe(struct platform_device *p= dev) =20 static int palmas_gpadc_remove(struct platform_device *pdev) { - struct iio_dev *indio_dev =3D dev_to_iio_dev(&pdev->dev); + struct iio_dev *indio_dev =3D dev_get_drvdata(&pdev->dev); struct palmas_gpadc *adc =3D iio_priv(indio_dev); =20 if (adc->wakeup1_enable || adc->wakeup2_enable) --=20 2.39.2