From patchwork Thu Apr 30 15:35:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Semen Protsenko X-Patchwork-Id: 6305211 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E47B19F1C2 for ; Thu, 30 Apr 2015 15:36:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 22062200DB for ; Thu, 30 Apr 2015 15:36:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 621CB20155 for ; Thu, 30 Apr 2015 15:36:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750946AbbD3Pge (ORCPT ); Thu, 30 Apr 2015 11:36:34 -0400 Received: from exprod5og112.obsmtp.com ([64.18.0.24]:55467 "EHLO mail-lb0-f177.google.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750804AbbD3Pgd (ORCPT ); Thu, 30 Apr 2015 11:36:33 -0400 Received: from mail-lb0-f177.google.com ([209.85.217.177]) (using TLSv1) by exprod5ob112.postini.com ([64.18.4.12]) with SMTP ID DSNKVUJMAGQuE6RgnMTCL5yCzMxGDL84qRSM@postini.com; Thu, 30 Apr 2015 08:36:33 PDT Received: by lbcga7 with SMTP id ga7so47682752lbc.1 for ; Thu, 30 Apr 2015 08:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=globallogic.com; s=google; h=from:to:cc:subject:date:message-id; bh=MzicJvJtB0BzknWrsJEP5AoR2pVdewqiVxYxMAQiCMY=; b=kDYWcy7Y1tgQ1hFK2UQjTguLzIudql3gygZXPXJs/rgfPTzSXhOIBZs+FhpzulwfLe 8zbPp/RE2/nd4VduOocs2+TV+arcW8NsHR0moOAgiNo/74VD9yHHbZP/xGeSjW0RAMRt AJhXyUWp+0NnVo8Kp9izM4GUjsZaKeZviQ/Wg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MzicJvJtB0BzknWrsJEP5AoR2pVdewqiVxYxMAQiCMY=; b=k0hiaN4UF9USj0YVI8CA2ldjjWSoasijMLJd6vYyHHf02fuZDPSoZU3PHuMZJoEORL uvxRvagUPy4uX/sTKis74yaWElzp5nN1BpLogrW1KWXOg/PI9z923WM2avNVRiiQpk0S fPOw4fg0ZKa5DiMeQCq0sVwaq+scqJgYKYYiulVRsoWEVl2/3IyoyAc7gmsTpk+m8wBX T/OMinqKcqv8HuaI4Kwk3azV56IaSYR7WMwMWpW/EpYG7COCqp0NgWcmrRiw5SVlUGyv rHFrnSi+zx6nCbw59CugZzC2pFN2rnivRZfo9SvcD+NT3WZ7MMOVG5IDAyz2tplhyU5I X/Fg== X-Gm-Message-State: ALoCoQnIkMcGnCulh2Q2RtOnstfJ+jQHr5zOZUXxx0RB96sJHB0iRU5Xrz5pU5Mad9T+6jd8OLiToQa9spv9RHV16u82VWyT91V9k6iGlvm5L4MtfXrlIgM2xMci+QoPeeKZ8UpMZXpjqs3uWnRztnWlumDOb0zwgQ== X-Received: by 10.152.203.162 with SMTP id kr2mr4428209lac.68.1430408191411; Thu, 30 Apr 2015 08:36:31 -0700 (PDT) X-Received: by 10.152.203.162 with SMTP id kr2mr4428201lac.68.1430408191316; Thu, 30 Apr 2015 08:36:31 -0700 (PDT) Received: from localhost ([195.238.92.132]) by mx.google.com with ESMTPSA id jl4sm675836lbc.14.2015.04.30.08.36.30 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 30 Apr 2015 08:36:30 -0700 (PDT) From: Semen Protsenko To: Greg Kroah-Hartman Cc: Jiri Slaby , Grygorii Strashko , Nishanth Menon , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org Subject: [PATCH v2] serial: omap: Fix error handling in probe Date: Thu, 30 Apr 2015 18:35:27 +0300 Message-Id: <1430408127-5237-1-git-send-email-semen.protsenko@globallogic.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_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 There is pm_qos_add_request() being executed on serial_omap_probe(), which stores "&up->pm_qos_request" from omap-serial driver to "pm_qos_array[PM_QOS_CPU_DMA_LATENCY]->constraints". If serial_omap_probe() fails after pm_qos_add_request() (e.g. on uart_add_one_port() call), pm_qos_array still keeping pm_qos_request struct from omap-serial driver, which is not valid anymore (since driver failed). This leads further to kernel crash on pm_qos_update_target(), executing from some completely different driver. We were observing this while trying to run audio playback while having one of omap-serial driver instances failed on uart_add_one_port() call: Unable to handle kernel paging request at virtual address fffffffc Backtrace: (plist_add) from (pm_qos_update_target) (pm_qos_update_target) from (pm_qos_add_request) (pm_qos_add_request) from (snd_pcm_hw_params) (snd_pcm_hw_params) from (snd_pcm_common_ioctl1) (snd_pcm_common_ioctl1) from (snd_pcm_playback_ioctl1) (snd_pcm_playback_ioctl1) from (snd_pcm_playback_ioctl) (snd_pcm_playback_ioctl) from (do_vfs_ioctl) (do_vfs_ioctl) from (SyS_ioctl) (SyS_ioctl) from (ret_fast_syscall) This patch adds pm_qos_remove_request() on fail path in serial_omap_probe() in order to fix this issue. While at it, free the wakeup settings on fail path as well, just like it's done in serial_omap_remove(). Signed-off-by: Semen Protsenko --- drivers/tty/serial/omap-serial.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 211479a..7f49172 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -1735,6 +1735,8 @@ static int serial_omap_probe(struct platform_device *pdev) err_add_port: pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); + pm_qos_remove_request(&up->pm_qos_request); + device_init_wakeup(up->dev, false); err_rs485: err_port_line: return ret;