From patchwork Tue Jan 7 20:53:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 234304 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 065E7C33C9B for ; Tue, 7 Jan 2020 21:18:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C7E5920880 for ; Tue, 7 Jan 2020 21:18:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431922; bh=mEoiRRRiyvq4fUVlCBdBtBnEX8SFrQs/gQdcwaGPweI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=v7JvuBcFf7yM9RXC0xXNmRcYX1XDcuXyDx6cYu5ElI3jaT8JkIXpCCoW7KBIeWT7f HDGPJJyLLIohKg3er67SWCJEA3EZipNDOXJ0l3Q+fnwBKXEjU5UAm4zZKhMYtev0IV q2DYqSrwBCpAkF35X6sYBOhpmj06NTzykEpfnu6w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726587AbgAGVSk (ORCPT ); Tue, 7 Jan 2020 16:18:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:50668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728779AbgAGVFC (ORCPT ); Tue, 7 Jan 2020 16:05:02 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C99612081E; Tue, 7 Jan 2020 21:05:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431102; bh=mEoiRRRiyvq4fUVlCBdBtBnEX8SFrQs/gQdcwaGPweI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ije/gydtrKl3RjGz6f8LarjkIGtEx6xuLNfralKq9tDxT5XygDfEPS3KwqJQ9db2P e4ki38WSmgoWT21s0k33KEP19heGV4/CEsrmScoOTlsm7kR1SeFZSAkl5l7MoQ1neg SbiCSWNbN9xWF4stgHIPfhMg6VXVSoqKUBU/S8s0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leonard Crestez , Matthias Kaehlcke , Chanwoo Choi , Sasha Levin Subject: [PATCH 4.19 007/115] PM / devfreq: Fix devfreq_notifier_call returning errno Date: Tue, 7 Jan 2020 21:53:37 +0100 Message-Id: <20200107205244.929267818@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Leonard Crestez [ Upstream commit e876e710ede23f670494331e062d643928e4142a ] Notifier callbacks shouldn't return negative errno but one of the NOTIFY_OK/DONE/BAD values. The OPP core will ignore return values from notifiers but returning a value that matches NOTIFY_STOP_MASK will stop the notification chain. Fix by always returning NOTIFY_OK. Signed-off-by: Leonard Crestez Reviewed-by: Matthias Kaehlcke Reviewed-by: Chanwoo Choi Signed-off-by: Chanwoo Choi Signed-off-by: Sasha Levin --- drivers/devfreq/devfreq.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 61fbaa89d7b4..34e297f28fc2 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -538,26 +538,28 @@ static int devfreq_notifier_call(struct notifier_block *nb, unsigned long type, void *devp) { struct devfreq *devfreq = container_of(nb, struct devfreq, nb); - int ret; + int err = -EINVAL; mutex_lock(&devfreq->lock); devfreq->scaling_min_freq = find_available_min_freq(devfreq); - if (!devfreq->scaling_min_freq) { - mutex_unlock(&devfreq->lock); - return -EINVAL; - } + if (!devfreq->scaling_min_freq) + goto out; devfreq->scaling_max_freq = find_available_max_freq(devfreq); - if (!devfreq->scaling_max_freq) { - mutex_unlock(&devfreq->lock); - return -EINVAL; - } + if (!devfreq->scaling_max_freq) + goto out; + + err = update_devfreq(devfreq); - ret = update_devfreq(devfreq); +out: mutex_unlock(&devfreq->lock); + if (err) + dev_err(devfreq->dev.parent, + "failed to update frequency from OPP notifier (%d)\n", + err); - return ret; + return NOTIFY_OK; } /**