Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp917500rdb; Sun, 18 Feb 2024 19:39:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWtqRGcMz0sobO1Vex0Q6BQx3OdmAXFK9QzohzMQ9TSdv7q3cyoXKgNXywoU9WDfMJH4MFiAIMiwAZRCWiXWkWtFR6SL5LGc7jzCpWbtg== X-Google-Smtp-Source: AGHT+IEQUN/dnwIH7Jvvs5ZU51A0dyIuIiF/f3/oKyfO1s6efqJkGpb2Fhr7QyCtKJKjzZuWOJde X-Received: by 2002:ae9:e013:0:b0:787:21f3:5dcf with SMTP id m19-20020ae9e013000000b0078721f35dcfmr13810414qkk.75.1708313951539; Sun, 18 Feb 2024 19:39:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708313951; cv=pass; d=google.com; s=arc-20160816; b=dupSiVteq97IyCUZgBXVVTlgRP/ktSCCXWXHrW7k88yHgLUEyQT6z706UzS04b0gWG 2KGY6cyjCecszUxj2M4kLUuGz335A4gNJlQNMYfaCzaHOMh2agma4o2DIZ4pGcpoJ6ga fi6quQ6chcPJcl1X1DSjkPyvHE6XOpWHpjp8aBsvJQhCZ8NMD5JckREUVaXQ1afmSQJc PH8tbdB0b5dA3NgH+ZhGIg9uykAovI3S/Xa0tI5eZ0JC7rGZY0jnQZtdk9GF1AHGQ2XJ rffpKsinNn+Z06HEOw2L0PmSqn8vOBmbHiBkZv3E3O/zUf1UcrQY/GDfxFo4b5BSy8w7 MMPw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=sTdLLlfSzJMgcnhecFRz9uWWXzFIcZA/5wybGJ1y3y8=; fh=y/RjPbXBoPouJTPaYxwEImQW6x8GRiLpamQFwed/jf0=; b=vzdAMWT8pfUe6aHlH87R0Jo/4zGolBzha6xZCeOljGivWk4J51OkzDrIE9Z6cP1eV6 rLRHe8YWQZpo/OgFacSIpQo1nWGloFzsrZhmZsNbRb+GUn/FlDfYt0M/be0ueupV/MLc zylxNwfHLFuHzo6ilQkESAvlZyNGCORJ/OelIAbX50ebk3s8flFaZtxipnjlJgXwqIVE 3Jmsi6JKAfsHqiniFQe7vHJ7RATy1vaSM/nhx/aFtZDrUROrvdSKfxjDOkC2mrDxh06K BdeB/clCNXhUhypzHZa9F7/hu0A+96chk2fHYjB5WVNSVEJZEhrpuAihK2ue4gxGTPMW vgTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="lMaEw+r/"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-70676-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70676-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id x2-20020a05620a0b4200b007873e3b4da3si5419095qkg.691.2024.02.18.19.39.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 19:39:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70676-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="lMaEw+r/"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-70676-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70676-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D51541C213A1 for ; Mon, 19 Feb 2024 03:39:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 143AA63A7; Mon, 19 Feb 2024 03:38:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lMaEw+r/" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D76AE5220; Mon, 19 Feb 2024 03:38:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708313938; cv=none; b=F/liB8MPTv0RXupzGjg+Dl5JYbk6H5zONtQZI3IgjBmaDvi2Tb6x2lAZkRzQkEkuK5paSRtBhgsJ2mXb3mY+NRmEqw4Zgbbvzu0ALImd7UNkSSGjrHQfIEV+NOVLoSlkLL4tLvDcvkIICpVf9BeEQk/Rrd4lQoIyjhOpQGqhTZ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708313938; c=relaxed/simple; bh=IdENPDV8Ed3IxJBmvwAplc7Nj3XPC3wlnxCHbUH17Uk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PwAzeW0fZOIRxWDnaD23jqQtqBKc44TOUqqvlVtSbnb/2sYqFs1ycrCIJgFRgw7O+iSGeF22GbOzltDNfJ+pHKyrsXtBJGY5dCLbWzqjgidYez6MDgSr9IlPrmWshbt/wg3C8zNSXFj3Z0pfAUvfLu11R91ESx2mWIoN9quqUWs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=none smtp.mailfrom=ecsmtp.iind.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=lMaEw+r/; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ecsmtp.iind.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708313937; x=1739849937; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IdENPDV8Ed3IxJBmvwAplc7Nj3XPC3wlnxCHbUH17Uk=; b=lMaEw+r/6C//tX4SV90OZr8PniIh3H2iwSAnKOZ1XxGFklTKkJp3Cv/T OAT2GiFcqImTEH1WINsyGSyjLolNXtvnijq+vnKUiyJyt4CiLgt7QwUmy kzz2ZGpcOq8Jt5u37NXnfU+2DaM1pPWS/gxTv+Q0dUejKBqrZZMXhPs6d FkkwCIHBCdzNs1WHq36s08/BiZAaGm0aFokydKrY4Aqx7BVbYTPAaGVJ4 K9YiLPelYkuJf8jXXY4JE0EpiaWA3KOXwcSCpVF+tbNXv2LLxDQQCFfps GLiAIi2MRtiBQwujHpAyb7U4sduXcXsR1Wrka0nUFlZjmIj9di9EdUOH1 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10988"; a="24838167" X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="24838167" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2024 19:38:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="4281849" Received: from inesxmail01.iind.intel.com ([10.223.57.40]) by fmviesa007.fm.intel.com with ESMTP; 18 Feb 2024 19:38:47 -0800 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id C557071913; Mon, 19 Feb 2024 09:08:45 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id C2BE11600101; Mon, 19 Feb 2024 09:08:45 +0530 (IST) From: Raag Jadav To: u.kleine-koenig@pengutronix.de, jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, lakshmi.sowjanya.d@intel.com Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, Raag Jadav Subject: [PATCH v4 1/4] pwm: dwc: Fix PM regression Date: Mon, 19 Feb 2024 09:08:32 +0530 Message-Id: <20240219033835.11369-2-raag.jadav@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240219033835.11369-1-raag.jadav@intel.com> References: <20240219033835.11369-1-raag.jadav@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit While preparing dwc driver for devm_pwmchip_alloc() usage, commit df41cd8bbcad ("pwm: dwc: Prepare removing pwm_chip from driver data") modified ->suspend() handle to use the pwm_chip as driver_data for accessing struct dwc_pwm, but didn't modify ->resume() handle with relevant changes. This results into illegal memory access during device wakeup and causes a PM regression. Fix this by correctly accessing struct dwc_pwm in ->resume() handle. Fixes: df41cd8bbcad ("pwm: dwc: Prepare removing pwm_chip from driver data") Signed-off-by: Raag Jadav --- drivers/pwm/pwm-dwc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-dwc.c b/drivers/pwm/pwm-dwc.c index 8ca1c20a6aaf..c0e586688e57 100644 --- a/drivers/pwm/pwm-dwc.c +++ b/drivers/pwm/pwm-dwc.c @@ -95,7 +95,8 @@ static int dwc_pwm_suspend(struct device *dev) static int dwc_pwm_resume(struct device *dev) { - struct dwc_pwm *dwc = dev_get_drvdata(dev); + struct pwm_chip *chip = dev_get_drvdata(dev); + struct dwc_pwm *dwc = to_dwc_pwm(chip); int i; for (i = 0; i < DWC_TIMERS_TOTAL; i++) { -- 2.35.3