From mboxrd@z Thu Jan 1 00:00:00 1970 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.2 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,URIBL_BLOCKED,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 377B4C4CEC4 for ; Mon, 23 Sep 2019 18:50:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C51120820 for ; Mon, 23 Sep 2019 18:50:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JMwtXzos"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="PC+bmEye" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C51120820 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4Z6cImloY9qKMabq6iga6EUE7X7278EJQmoAk+cxwGU=; b=JMwtXzosZKLCYi E/seMpaeljBX9WIA1EUoXBOJ7Y0BUcL1NA8e3dIqxloTK4gp5Kl4ut3BOR3bLR1EqW2Nz3/YzEEYI e5VDE3zetXKGr0r2w7LLwa46PtSpjC/jzoESrGzDBittBNmSkaJ5LcljqMSDLLslS4pKiWm++SIL4 yfLy1ulxf1ckPKJ5fYlv7hK4BhxUhf6aHMPsBi3I6qb7Nu5e1fQ5o8JJnyvJeAAkLpR2Mktv0LS2m TG6LqR+9ay4fu2e97TIYZwjjLPah0bMqL/BQdE3KgaokrDhdnjM21Rlqk6WEfzP4LtyekGYd0bVnj GfGudl+px5HMz4eABFtg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iCTQF-0002VY-6q; Mon, 23 Sep 2019 18:50:55 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iCTQB-0002Uv-4s for linux-arm-kernel@lists.infradead.org; Mon, 23 Sep 2019 18:50:52 +0000 Received: by mail-pg1-x542.google.com with SMTP id s1so7369941pgv.8 for ; Mon, 23 Sep 2019 11:50:50 -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=OFEreeiuCWUIubUDu2nto0CXXCx0l8DJdtGf7sQk5hI=; b=PC+bmEyewuG+cCx1WrX3c9poig072MLtq/y1UcRcWcBXMSKhoY0i5IiADx21Q9ZQiI ucpQftg/fj56BCAHbQjurIeU5lwudfMoc8oN+4M4HGsrMOUnW/vcJcu+rOTvaI6E/Xce YLmVdHUNPoxYwHaMxhb/IQGLNj2dQkNbhBkjg= 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=OFEreeiuCWUIubUDu2nto0CXXCx0l8DJdtGf7sQk5hI=; b=HFKA9mKv69wl4jKEc9drIK4RLtNQX8oL0JboEeT0OsayRbYmx9kzMHhDl3FzBufJwe xorLdu9U8vC5Kg1Zvg+PUnGgbg8O05tIHkz01DdTTt0ADmcwQIcc4jRHxE6BdhTIkTX6 6kP/210lXumpJ8bOcsy/PR1H7Zi/hVPqhmj8oNCQvgNs+gESdXpFkZ/z40Nw9Quwmn/x BANoMPRtlmjQc0zUMs9C7AVCfxK7QrWtw6An57Kb8OOYxzqCE9bQQkfhhLcg2ymanwpQ YWdIoekQMF5QwEQP6qlpax/2LukRiV672xb1OpAwIIS4F+vACEKjsZJDGuqUf1CfTtF5 3SXw== X-Gm-Message-State: APjAAAVpUvVNaJl2Ab1tvSw6Xi0oRm/A+j2ajCa2igNM5E+pwTdX2dSi t7D6ujAneBQc+t3LPxNwOR9GNA== X-Google-Smtp-Source: APXvYqwtX/NH+k4fVe4nAuqpRJwbGGrTrWKGRhBCpwxl3cOXJkcFUpjjDRPZQlN/cssPs2EU87T9hw== X-Received: by 2002:a17:90a:8001:: with SMTP id b1mr1024129pjn.10.1569264650065; Mon, 23 Sep 2019 11:50:50 -0700 (PDT) Received: from localhost ([2620:15c:202:1:75a:3f6e:21d:9374]) by smtp.gmail.com with ESMTPSA id h6sm17603497pfg.123.2019.09.23.11.50.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Sep 2019 11:50:49 -0700 (PDT) Date: Mon, 23 Sep 2019 11:50:47 -0700 From: Matthias Kaehlcke To: Leonard Crestez Subject: Re: [PATCH] PM / devfreq: Check NULL governor in available_governors_show Message-ID: <20190923185047.GC133864@google.com> References: <96f459015e6418cee4fa20fdbdb80c4caf417c19.1569256298.git.leonard.crestez@nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <96f459015e6418cee4fa20fdbdb80c4caf417c19.1569256298.git.leonard.crestez@nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190923_115051_190267_23D88257 X-CRM114-Status: GOOD ( 17.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Artur =?utf-8?B?xZp3aWdvxYQ=?= , linux-pm@vger.kernel.org, Krzysztof Kozlowski , Lukasz Luba , Chanwoo Choi , Kyungmin Park , MyungJoo Ham , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 23, 2019 at 07:34:43PM +0300, Leonard Crestez wrote: > The governor is initialized after sysfs attributes become visible so in > theory the governor field can be NULL here. > > Signed-off-by: Leonard Crestez > --- > drivers/devfreq/devfreq.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > Found this by hacking device core to call attribute "show" functions > from inside device_add. > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > index 00fc23fea5b2..896fb2312f2f 100644 > --- a/drivers/devfreq/devfreq.c > +++ b/drivers/devfreq/devfreq.c > @@ -1322,11 +1322,11 @@ static ssize_t available_governors_show(struct device *d, > > /* > * The devfreq with immutable governor (e.g., passive) shows > * only own governor. > */ > - if (df->governor->immutable) { > + if (df->governor && df->governor->immutable) { > count = scnprintf(&buf[count], DEVFREQ_NAME_LEN, > "%s ", df->governor_name); > /* > * The devfreq device shows the registered governor except for > * immutable governors such as passive governor . Reviewed-by: Matthias Kaehlcke _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel