From patchwork Mon Feb 15 19:34:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 8318211 Return-Path: X-Original-To: patchwork-linux-pm@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 2E3A69F2F0 for ; Mon, 15 Feb 2016 19:35:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C1F9202FE for ; Mon, 15 Feb 2016 19:35:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 67D81202FF for ; Mon, 15 Feb 2016 19:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751177AbcBOTe7 (ORCPT ); Mon, 15 Feb 2016 14:34:59 -0500 Received: from bh-25.webhostbox.net ([208.91.199.152]:54414 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751014AbcBOTe6 (ORCPT ); Mon, 15 Feb 2016 14:34:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=Message-Id:Date:Subject:Cc:To:From; bh=VhKZMpZIaIrgdMNUBLzBgZicDUgs40mK680D10rf0aA=; b=AUrjMWaGu0UApC8EChZmVvtLr6 LPYDowbQ763HynSeGstZE1/NgtmoZtObfqh9SqZ4TVuhpfODOYpzz2IT3l+WfhCfoHM87h1Rvr9t6 u8wh2xMyQT/zgAeQU2o3qYFTrJVP3fJuqmgeMubhKKis4PMPbVObo5FRO/GlUdiMKhT9K/CkZgly1 O67p22/FadV8WS/JL3Y7AYAoDB3HJ2rREqyZtqUvoLWAQUmHv5YSKj6Cy9PWoH2uinysVCqHRKXk4 hNKYHYdLf7FXn2nnxECpYZCZvZzRovg84PxsZDTFRdwrL9AxAXwFkle50Ng7/h7gYFnfnm1oZSfkw xVPuYrjQ==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:51380 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86) (envelope-from ) id 1aVOvB-002VEN-Tf; Mon, 15 Feb 2016 19:34:58 +0000 From: Guenter Roeck To: Viresh Kumar Cc: Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck , Viresh Kumar Subject: [PATCH -next] PM / OPP: Fix crash seen if CPU clock has no voltage regulator Date: Mon, 15 Feb 2016 11:34:53 -0800 Message-Id: <1455564893-25455-1-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.5.0 X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 omap3 overo boots crash with Unable to handle kernel NULL pointer dereference at virtual address 00000030 pgd = c0204000 [00000030] *pgd=00000000 Internal error: Oops: 17 [#1] SMP ARM ... [] (regulator_set_voltage) from [] (_set_opp_voltage+0x34/0x90) [] (_set_opp_voltage) from [] (dev_pm_opp_set_rate+0x19c/0x288) [] (dev_pm_opp_set_rate) from [] (__cpufreq_driver_target+0x17c/0x29c) [] (__cpufreq_driver_target) from [] (dbs_check_cpu+0x19c/0x1e4) [] (dbs_check_cpu) from [] (cpufreq_governor_dbs+0x308/0x5c4) [] (cpufreq_governor_dbs) from [] (__cpufreq_governor+0x20c/0x24c) [] (__cpufreq_governor) from [] (cpufreq_init_policy+0x60/0x8c) [] (cpufreq_init_policy) from [] (cpufreq_online+0x2cc/0x6d8) [] (cpufreq_online) from [] (subsys_interface_register+0x80/0xc4) [] (subsys_interface_register) from [] (cpufreq_register_driver+0x144/0x1a0) [] (cpufreq_register_driver) from [] (dt_cpufreq_probe+0x64/0xe8) [] (dt_cpufreq_probe) from [] (platform_drv_probe+0x50/0xb0) [] (platform_drv_probe) from [] (driver_probe_device+0x1f4/0x2b0) ... Analysis shows that regulator==NULL in regulator_set_voltage(). Code around _set_opp_voltage() suggests that having no voltage regulator attached to a CPU clock is valid, so do not attempt to set a voltage in that case. Fixes: 6a0712f6f199e ("PM / OPP: Add dev_pm_opp_set_rate()" Cc: Viresh Kumar Signed-off-by: Guenter Roeck --- drivers/base/power/opp/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c index d7cd4e265766..82ad5ae72427 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c @@ -564,7 +564,7 @@ static int _set_opp_voltage(struct device *dev, struct regulator *reg, int ret; /* Regulator not available for device */ - if (IS_ERR(reg)) { + if (IS_ERR_OR_NULL(reg)) { dev_dbg(dev, "%s: regulator not available: %ld\n", __func__, PTR_ERR(reg)); return 0;