Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1253244pxb; Thu, 4 Feb 2021 08:27:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwszRIy/x/x73QXQ1YbNWIwdiyWm5jGXcf7eoNAwYKDgiFk3PF5nEdkUvIiUQq43JR1oY0l X-Received: by 2002:a05:6402:35d6:: with SMTP id z22mr8570654edc.58.1612456027133; Thu, 04 Feb 2021 08:27:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612456027; cv=none; d=google.com; s=arc-20160816; b=LEuJxPuU5WKbsbpA45R3JDk5WztTvpfXdbczMfY0UPHE/bUvBL/d41KZ3wqdEkwkua qthKTWQfzAbp2IuumSEjCMMnHwBDDWYAAWgImrnpc/2deznjQgL429fGtx61wMNiFIeT zgvPnWlVx8qSgonyrlCa0PgN4hz0c6yVsZxzh0TV2co6IpSDEi1NANc4g7VpZrjj3kE9 iPqQsWRn1660l9XU0DDxOCF4obmmYFwxiSz3u5ctHCOubF8GgY/ES3PqwR9YzglBT51N xjwDAgKAkhmpTCHekyN0INcRXli37S03NfPT96fTQrrEY1pLTbAhKH3NJdK8Crj9bfHh 0pKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=mLHUheX144OUCKrRDcQ3sskV3anc0+eFy1rDH/g9KUo=; b=qP1AA6D6RYodPWyOV9Kse5b0ko+urQuGObqRfmmxMbpqxFDbOR4aSHtPXpMOm3bi/o 4Ouw/1piG6L3XrMpBzURl6nYYqc1HFP4/cBlqW51pyZLPUjR+JTD/PL5ulU3knQkA82t YJJYtpyhNBJzLaHOOEOT8WnV9ecATS9BAnDJzYCnDumBXerGKg585605vvyfNILN9BfP Fsn0y8VJIYC4cgDMDk4U4qvbYxt2wGk7L2dTDpMWGFUzFmbD+D2lK1YKuVRrQKmDeQJN HPk/OqxaDPNFkToYK8+MniRPBDlUwD6FsK0TBq2jFOybTUJqxUAtwsui2wFhtNoCiGaw UBaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ofW8Zg13; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si3184914ejx.754.2021.02.04.08.26.41; Thu, 04 Feb 2021 08:27:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ofW8Zg13; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237087AbhBDQWT (ORCPT + 99 others); Thu, 4 Feb 2021 11:22:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237005AbhBDPLk (ORCPT ); Thu, 4 Feb 2021 10:11:40 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48A23C0613D6 for ; Thu, 4 Feb 2021 07:11:00 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id o10so6122565wmc.1 for ; Thu, 04 Feb 2021 07:11:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=mLHUheX144OUCKrRDcQ3sskV3anc0+eFy1rDH/g9KUo=; b=ofW8Zg13fOOYn/rvPdARW/xpvDh/i9PblhVOZqwAuj4Kktui9pwUTA/EXUanbTUM// 1OFfCw8mZI9zbLPvJH4XxSlCHNbR18sdt9y0sOn7eihZiD2ouhjLoqj6+U5VCbeZD/GR C0uzalJqZzLejZWpWBecSIapQdXg5C4jOltfnTvpiXAlOGP8xh2k2p9xiN5kMfg3LKtK 6G4QNHUrWFthegZIQrOgca1axBq0MsUIChYilgOS46G0lZ/7sOpmiBSLgkeksjl4BU6t PrVoGhBPRy6pEo3zDwgxnQpVHo3K5YNbCxXFz0ZK7M2UKJdGbgIstFSwybpKb9penGxZ Z/pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=mLHUheX144OUCKrRDcQ3sskV3anc0+eFy1rDH/g9KUo=; b=TyA0jC8TcrE7PbIiFqjV8n8vjhAnHsOL+ry4xkc2oP/Fu7JLul/fYYRCfPcGDpWYQk eI5e4ImMaR0qlYJ8ZTB/HLzEdYaS9v8u/2UhNrKJWIsZrNdq8GYgCk90Zk0wEJFyH/Hx RP48xMAcmwTL4tYoFqoEGs+Vs5C0Y8WxrFQVSw+hSmY0hMC9mak9wufYuSY05PukUQ+b QvyI951vTr9/oVKU6tb7FfaH5ih0ev3WWJHcMpoPQWVJvCuFcUAx5oQx3vKTP0O9kVg9 VujNiTZasZC48nudOx+hKFJD16hNd756yZzwrKc4iOQb3HPhRB/oJPwL8g/mTm2AcJ3t s+gg== X-Gm-Message-State: AOAM530Tihmmg3fxn6uB1TjKwYbxQ9cVwiDTiL7mCgtjV3YFlvVJhkJ0 RBFMhpa6ghimLk+FNwTrR28= X-Received: by 2002:a7b:c950:: with SMTP id i16mr8933wml.52.1612451458908; Thu, 04 Feb 2021 07:10:58 -0800 (PST) Received: from [192.168.2.202] (p5487b0c0.dip0.t-ipconnect.de. [84.135.176.192]) by smtp.gmail.com with ESMTPSA id y63sm6238750wmd.21.2021.02.04.07.10.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Feb 2021 07:10:58 -0800 (PST) Subject: Re: drivers/platform/surface/surface3-wmi.c:60:14: warning: variable 'status' set but not used To: Hans de Goede , kernel test robot Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, Andy Shevchenko References: <202012291140.j73hBz45-lkp@intel.com> <184b4ec6-65f1-5a22-487b-20cc0fb1b587@redhat.com> <1a749e41-86da-8607-ec39-c91cf4107a9f@gmail.com> <80b763f8-8a19-aada-ae49-515fda2f209c@redhat.com> From: Maximilian Luz Message-ID: Date: Thu, 4 Feb 2021 16:10:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <80b763f8-8a19-aada-ae49-515fda2f209c@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/4/21 12:36 PM, Hans de Goede wrote: > Hi, > > On 1/4/21 4:24 PM, Maximilian Luz wrote: >> On 1/4/21 3:52 PM, Hans de Goede wrote: >>> Hi, >>> >>> On 12/29/20 4:58 AM, kernel test robot wrote: >>>> Hi Maximilian, >>>> >>>> FYI, the error/warning still remains. >>>> >>>> tree:?? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master >>>> head:?? dea8dcf2a9fa8cc540136a6cd885c3beece16ec3 >>>> commit: f23027ca3d48b6f93c5994069fb25b73539fdf34 platform/surface: Move Surface 3 WMI driver to platform/surface >>>> date:?? 9 weeks ago >>>> config: x86_64-randconfig-r001-20201221 (attached as .config) >>>> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 >>>> reproduce (this is a W=1 build): >>>> ???????? # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f23027ca3d48b6f93c5994069fb25b73539fdf34 >>>> ???????? git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git >>>> ???????? git fetch --no-tags linus master >>>> ???????? git checkout f23027ca3d48b6f93c5994069fb25b73539fdf34 >>>> ???????? # save the attached .config to linux build tree >>>> ???????? make W=1 ARCH=x86_64 >>>> >>>> If you fix the issue, kindly add following tag as appropriate >>>> Reported-by: kernel test robot >>>> >>>> All warnings (new ones prefixed by >>): >>>> >>>> ??? drivers/platform/surface/surface3-wmi.c: In function 's3_wmi_query_block': >>>>>> drivers/platform/surface/surface3-wmi.c:60:14: warning: variable 'status' set but not used [-Wunused-but-set-variable] >>>> ?????? 60 |? acpi_status status; >>>> ????????? |????????????? ^~~~~~ >>> >>> I guess fixing this would require something like this: >>> >>> From: Hans de Goede >>> Subject: [PATCH] platform/surface: surface3-wmi: Fix variable 'status' set but not used compiler warning >>> >>> Explictly check the status rather then relying on output.pointer staying >>> NULL on an error. This silences the following compiler warning: >>> >>> drivers/platform/surface/surface3-wmi.c:60:14: warning: variable 'status' set but not used [-Wunused-but-set-variable] >>> >>> Reported-by: kernel test robot >>> Signed-off-by: Hans de Goede >>> --- >>> ? drivers/platform/surface/surface3-wmi.c | 4 ++++ >>> ? 1 file changed, 4 insertions(+) >>> >>> diff --git a/drivers/platform/surface/surface3-wmi.c b/drivers/platform/surface/surface3-wmi.c >>> index 130b6f52a600..4b7f79c0b78e 100644 >>> --- a/drivers/platform/surface/surface3-wmi.c >>> +++ b/drivers/platform/surface/surface3-wmi.c >>> @@ -63,6 +63,10 @@ static int s3_wmi_query_block(const char *guid, int instance, int *ret) >>> ? ????? mutex_lock(&s3_wmi_lock); >>> ????? status = wmi_query_block(guid, instance, &output); >>> +??? if (ACPI_FAILURE(status)) { >>> +??????? error = -EIO; >>> +??????? goto out_free_unlock; >>> +??? } >>> ? ????? obj = output.pointer; >>> >>> Maximilian, can you review and/or test this fix please ? >> >> Ah, this was on my TODO list (among looking at some other things in this >> driver), sorry that I haven't gotten to it yet. I'd have proposed pretty >> much the exact same thing. >> >> One thing to note though: You should initialize obj with NULL. Keeping >> it uninitialized may mess with kfree() under out_free_unlock. >> >> Unfortunately I don't have access to a Surface 3 to test, but apart from >> not initializing obj, this patch looks good to me. You may add my >> reviewed-by tag once you've fixed that. > > Thank you, and sorry for being a bit slow with my follow up. No worries. > I've added the obj = NULL initialization and added your reviewed-by tag. > > I'm sending this out as an official patch submission for the archives now > and then I'll apply it to my review-hans branch right away, so no need > for you to do anything :) > >> Also note that drivers/platform/x86/msi-wmi.c suffers from the same >> problem in msi_wmi_query_block() and should receive a similar fix. > > Thanks, I'll prep a patch for that too. Perfect, thanks! Regards, Max > > Regards, > > Hans >