From mboxrd@z Thu Jan 1 00:00:00 1970 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 9CCF6C77B71 for ; Thu, 13 Apr 2023 02:36:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229911AbjDMCgl (ORCPT ); Wed, 12 Apr 2023 22:36:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbjDMCg3 (ORCPT ); Wed, 12 Apr 2023 22:36:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB7BE7EF0; Wed, 12 Apr 2023 19:36: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 3059A63A8B; Thu, 13 Apr 2023 02:36:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D97EAC433EF; Thu, 13 Apr 2023 02:36:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681353377; bh=0tlCgn/g2uLNgXFgxB/PsjI7UdfHzqyRNbDgd1eDnxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q9n5pSiOyLSUsI7ini0x4T1/72aCk9c0NSLgs5B4gkzo0E2muQNpAH1q3c0ql0/tE ryZdFdIyrnstcybf/nzGk4LLKd9gbhCCyNg9AYMfCvuLy4KulCcSzCRUMgaq0Uqqwd GMoZdkzGhI7Jc8XTwjSDkXNSRJpeUjpk8eYbNcourRRP7ihxbjfwlxzY3y0THhmNjG sV2ioyYX2DifNcRAsW8gW2g0pqRBercdESz/Ty7fGZ0Vqbp1LewYjTi8b/OLF/8+VN qBuo4Z8PTXdoU0vwcAst37BPBb8JexnZ6vhheAQ3189ll2Y/IsF631TWD7GHuRL7Tu Tg/sy0wwV9Ptw== 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 6.2 06/20] iio: adc: palmas_gpadc: fix NULL dereference on rmmod Date: Wed, 12 Apr 2023 22:35:44 -0400 Message-Id: <20230413023601.74410-6-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230413023601.74410-1-sashal@kernel.org> References: <20230413023601.74410-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Patrik Dahlström [ 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öm 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 fd000345ec5cf..849a697a467e5 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c @@ -639,7 +639,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) -- 2.39.2