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=-8.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 AB8CAC4360C for ; Wed, 2 Oct 2019 21:24:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D7E521783 for ; Wed, 2 Oct 2019 21:24:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="e+mqSw6I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728967AbfJBVYl (ORCPT ); Wed, 2 Oct 2019 17:24:41 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:39981 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728220AbfJBVYk (ORCPT ); Wed, 2 Oct 2019 17:24:40 -0400 Received: by mail-pl1-f195.google.com with SMTP id d22so437187pll.7 for ; Wed, 02 Oct 2019 14:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=BTX2GSqsV6kTV3Pvc2Q5r/mtwfFtpL/CWWCZhRetRTs=; b=e+mqSw6IJR/B8mgIbtZx5sXFHlfRMudyijdRdZcL/hU1q1tmLM2a1dbNTj/hXPA32A R4lmEhkE/aB2z9ocxsZI3htEOlWQ3VoY4WfURw82rbWl32W10jRyLe+LM9cxvTQH2MPP Pwl87v9ABp4brXG9bQLv8pR5o2qTMabu8321Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=BTX2GSqsV6kTV3Pvc2Q5r/mtwfFtpL/CWWCZhRetRTs=; b=Cjtt/fy7kuoIAY0qWcB17IJ6CUYqqd68jusuiHT/V/Ai8msx0utK1e1bdFgiY9XN4U Ir5mQnApPEx9WlQ+RhcnTZlzXWYa8r9VYrZAfTcYbSw7+1qUCfoLMZ+3LveNDJu9RBGO EKIoS/P6oFzVezwgZqVMYIdir2ePwTDbUIWZEli6bJ2HprNrKTUldOV5RqUz8Hz1LcAy Ny7FeVt3StuzyvQuzek/N+tCDbXGNTNQ12GeS546YMhqXrkPSdxrAAK9agRAu/kgxjQH xlzHnBJWxZ67gA5BvpgGrVWw0tEVcJ1eT0yi10FpOW+pqncOdfDuIYSNotqdh/yVTNob 9H/Q== X-Gm-Message-State: APjAAAVPX2R2++ZdDcaq/uUylWiQm01edIeLJykgoQwp2A0MqgjN32U7 2vJgv/z130IP3apdepXdpKwXGQ== X-Google-Smtp-Source: APXvYqzbfa2TsOro/cQ8MOAqKaucPW2GW2LTOZyN9kOeBft1PqNo4OgVbQ2Q5v33eGeomCew+95xYQ== X-Received: by 2002:a17:902:680d:: with SMTP id h13mr6026330plk.300.1570051480042; Wed, 02 Oct 2019 14:24:40 -0700 (PDT) Received: from localhost ([2620:15c:202:1:4fff:7a6b:a335:8fde]) by smtp.gmail.com with ESMTPSA id y10sm369518pfe.148.2019.10.02.14.24.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Oct 2019 14:24:39 -0700 (PDT) Date: Wed, 2 Oct 2019 14:24:37 -0700 From: Matthias Kaehlcke To: Leonard Crestez Cc: Chanwoo Choi , MyungJoo Ham , Kyungmin Park , Artur =?utf-8?B?xZp3aWdvxYQ=?= , Saravana Kannan , Krzysztof Kozlowski , Alexandre Bailon , Georgi Djakov , Abel Vesa , Jacky Bai , Viresh Kumar , Lukasz Luba , NXP Linux Team , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v9 2/8] PM / devfreq: Fix devfreq_notifier_call returning errno Message-ID: <20191002212437.GF87296@google.com> References: <10b1e5f93e7594852aa5cbfe1309bf486f70ecbb.1570044052.git.leonard.crestez@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <10b1e5f93e7594852aa5cbfe1309bf486f70ecbb.1570044052.git.leonard.crestez@nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On Wed, Oct 02, 2019 at 10:25:05PM +0300, Leonard Crestez wrote: > 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 > --- > 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 7dc899da1172..32bbf6e80380 100644 > --- a/drivers/devfreq/devfreq.c > +++ b/drivers/devfreq/devfreq.c > @@ -548,30 +548,32 @@ EXPORT_SYMBOL(devfreq_interval_update); > */ > 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); In case an OPP freq can't be found the log doesn't provide clues about what the problem could be. I couldn't find a clearly superior errno value though, so I guess this is as good as it gets, unless you want to have a dedicated message for those errors. Should be a rare exception anyway, and previously there was no log at all. Reviewed-by: Matthias Kaehlcke