From patchwork Tue Aug 13 12:40:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 2843601 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EFB69BF546 for ; Tue, 13 Aug 2013 12:41:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B2F0D203FD for ; Tue, 13 Aug 2013 12:41:37 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 39E58203E9 for ; Tue, 13 Aug 2013 12:41:36 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9DuZ-000393-Qf; Tue, 13 Aug 2013 12:41:20 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9DuS-0006Ld-A2; Tue, 13 Aug 2013 12:41:12 +0000 Received: from svenfoo.org ([82.94.215.22] helo=mail.zonque.de) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9DuM-0006KP-M0 for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2013 12:41:07 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.zonque.de (Postfix) with ESMTP id 9DF25C15FF; Tue, 13 Aug 2013 14:40:42 +0200 (CEST) Received: from mail.zonque.de ([127.0.0.1]) by localhost (rambrand.bugwerft.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Mik35JidX6oC; Tue, 13 Aug 2013 14:40:42 +0200 (CEST) Received: from tamtam.fritz.box (p5DDC5F3D.dip0.t-ipconnect.de [93.220.95.61]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.zonque.de (Postfix) with ESMTPSA id F02B7C15F9; Tue, 13 Aug 2013 14:40:41 +0200 (CEST) From: Daniel Mack To: linux-usb@vger.kernel.org Subject: [PATCH] usb: musb dsps: fix pdev cast in suspend/resume Date: Tue, 13 Aug 2013 14:40:30 +0200 Message-Id: <1376397630-26863-1-git-send-email-zonque@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130813_084106_862687_E828ADCF X-CRM114-Status: GOOD ( 11.45 ) X-Spam-Score: -0.3 (/) Cc: paul@pwsan.com, khilman@linaro.org, d-gerlach@ti.com, gregkh@linuxfoundation.org, balbi@ti.com, Daniel Mack , damodar.santhapuri@ti.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP dsps_suspend() and dsps_resume() are called with the device that has the glue assigned as drvdata. Using dev->parent seems wrong and causes a NULL pointer exception on an AM33xx board. The code was introduced by commit c68bb4c6 ("usb: musb: dsps: control module handling (quirk)") but I wonder whether it was ever used. Signed-off-by: Daniel Mack --- drivers/usb/musb/musb_dsps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 5233804..f20218e 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -692,7 +692,7 @@ static int dsps_remove(struct platform_device *pdev) #ifdef CONFIG_PM_SLEEP static int dsps_suspend(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev->parent); + struct platform_device *pdev = to_platform_device(dev); struct dsps_glue *glue = platform_get_drvdata(pdev); const struct dsps_musb_wrapper *wrp = glue->wrp; int i; @@ -705,7 +705,7 @@ static int dsps_suspend(struct device *dev) static int dsps_resume(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev->parent); + struct platform_device *pdev = to_platform_device(dev); struct dsps_glue *glue = platform_get_drvdata(pdev); const struct dsps_musb_wrapper *wrp = glue->wrp; int i;