Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2948978imc; Wed, 13 Mar 2019 05:23:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/oBWSLtL+MrIYDmXUOLLcfHo3GWV/O6zPmeA/B1mq7TmqFlOtNm6PjgUYAZWpFkeo/uJs X-Received: by 2002:a62:e716:: with SMTP id s22mr43343925pfh.35.1552479821438; Wed, 13 Mar 2019 05:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552479821; cv=none; d=google.com; s=arc-20160816; b=iDV3/TBu3wrDUCdIqkFXeKrCeIBJwL+3P6XycZYs7r7iPG3xO4h85EziOCGUoHEaPi eGHnCM+yNAVi7YZFCqfzU6buni3o56goDSZEXD6wsr5OuI1C7B4zRKysWbS9I4KYenwv b9k1GY6fcVmDRH6S3ODex95LNbpLEk7MY9j1ucKZh1TSQf4XeorE4zbB6427ObiqwdiS 8MGLo4ZoS/HdnHH6k2bK9BMSOSOljXIFauxXT1fn7hineKABfWDSiScxmVk3muGJd86A mXWUVN/J0dYPVN8WViOFRLUq8KB3tjorMsC6HQE+dN5d1nH+Ef67l6nkkdR8gmCOuj30 HCzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Or/0IL10iVV8FLJz0B/fALtqa8s52AhgyE6Jqx1Vq/c=; b=sfrfxwn3kofSxTDhjV7Js+X+B9p2uNJF8nnE29epsmCe6XYqOYvc+5/ltxpb9Gga7q 9GwBcdyfb+xW7mff2E9gCthKGVmAVVkr9kH7fxya6FgVlERP4sSUKhUvpvuxK9kgTKe8 a0KOYZtRpBZ8UpI5Y+whi//GTI1v3gUQ0Knno3DXkc59a7NvjK6iPZ4zkuKGGyC7G4gm f2f++IJgtE4YToY3jGBw+woBdKbEy+EH1Xd8Zyhhf5dZXeIJjWPOVGQJ4Uh1Fft8wSlO ixDUxhbs6M/93i0dD3UftO3iXFLNk36wM4gyP5EXileQRSZhr+mZCUyZtnKicR+N9FSd Pz8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z8si9638713pgu.224.2019.03.13.05.23.25; Wed, 13 Mar 2019 05:23:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726130AbfCMMXG (ORCPT + 99 others); Wed, 13 Mar 2019 08:23:06 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:35672 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbfCMMXG (ORCPT ); Wed, 13 Mar 2019 08:23:06 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 7405327FB58 From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Cc: kernel@collabora.com, Dan Carpenter , Chanwoo Choi , Kyungmin Park , MyungJoo Ham , linux-pm@vger.kernel.org Subject: [RESEND PATCH] PM / devfreq: Fix static checker warning in try_then_request_governor Date: Wed, 13 Mar 2019 13:22:53 +0100 Message-Id: <20190313122253.24355-1-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch 23c7b54ca1cd: "PM / devfreq: Fix devfreq_add_device() when drivers are built as modules." leads to the following static checker warning: drivers/devfreq/devfreq.c:1043 governor_store() warn: 'governor' can also be NULL The reason is that the try_then_request_governor() function returns both error pointers and NULL. It should just return error pointers, so fix this by returning a ERR_PTR to the error intead of returning NULL. Fixes: 23c7b54ca1cd ("PM / devfreq: Fix devfreq_add_device() when drivers are built as modules.") Reported-by: Dan Carpenter Signed-off-by: Enric Balletbo i Serra Reviewed-by: Chanwoo Choi --- Hi, This is a resend of [1] as seems that got lost at some point and I just noticed that was never merged. Thanks, Enric [1] https://lkml.org/lkml/2018/10/16/744 drivers/devfreq/devfreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 0ae3de76833b..839621b044f4 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -228,7 +228,7 @@ static struct devfreq_governor *find_devfreq_governor(const char *name) * if is not found. This can happen when both drivers (the governor driver * and the driver that call devfreq_add_device) are built as modules. * devfreq_list_lock should be held by the caller. Returns the matched - * governor's pointer. + * governor's pointer or an error pointer. */ static struct devfreq_governor *try_then_request_governor(const char *name) { @@ -254,7 +254,7 @@ static struct devfreq_governor *try_then_request_governor(const char *name) /* Restore previous state before return */ mutex_lock(&devfreq_list_lock); if (err) - return NULL; + return ERR_PTR(err); governor = find_devfreq_governor(name); } -- 2.20.1