Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp336489pxb; Thu, 5 Nov 2020 01:03:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxuca/DXJfyGJgWyvtEyPI9yRRrRPgNIjd97ZC51ep495v6SXR8VmiBXLU436B2cchV5Vn4 X-Received: by 2002:aa7:cb02:: with SMTP id s2mr1450796edt.211.1604566980092; Thu, 05 Nov 2020 01:03:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604566980; cv=none; d=google.com; s=arc-20160816; b=zCflPle7oTdOkoyNhImJTmF/4MXf3GokDPF9CB/X7F+UkBCo34FgUxrQ8EDghoRYUz PdH7GAD+jHQuaBWBkSUOS+C2mK4bPvYHEOaZxeR0v5/Hx0aSaP1eLlDq8V0N6HsiTAz0 vBThcI5PElDgVixoNzr6Z3WgQHKmdZHqwORewPpAmaAUZSSKZIepogqqpgxk4p8H01Ve nLBWIBtLV07cNUVPKwunagMKWvzsbM8SFNLJ36DZiidSweW/hjfELujuFYkVbBAVGdbu xrjD+OTMaC5oEXCi2TV8dTA4K+MdfZEMcV2AnWtKLL4+7ngHxPgmqStmijEu6TA/Nme5 qBwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OC9aACGGqpKEo7MnuaDGqRBy9T/1FYSfYU5LJ+QJCl8=; b=rlLD+f0j6NbTqu8D9uVXD7RwFGGQFAft59y9SlMxrYd4k+qhR5V9qQaVYjJM28acxl cw5tlYpC7fBGX1ZZ3m0RYJ3OmSclTKIPygh6JVrqN1vU+6Am95CrhXh6uUj2v4cvdD/+ CS4zRBVli5OoCXdmYROJR4iU9abjfpbgm5MCfItVoAg6B8yxaGqXYkbJqvzpgx9tAk+B /L3tqkY/cSMjOS4arNTE4nQIrbG9Y4rqa8VwG6v7t0AhCtT+sX5iFVWaFUpzuZYq9Fdv RXtjIHn0m9cdvhCJ7BC2PJGxIwzIOSC3K/GFK3PnVWBjlJmtA95dYoDTbe6Y5s7y4f3o 9iwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iet3rID4; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h22si660198eje.314.2020.11.05.01.02.37; Thu, 05 Nov 2020 01:03:00 -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=@linaro.org header.s=google header.b=iet3rID4; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730710AbgKEJAN (ORCPT + 99 others); Thu, 5 Nov 2020 04:00:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730679AbgKEJAM (ORCPT ); Thu, 5 Nov 2020 04:00:12 -0500 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF2D5C0613D2 for ; Thu, 5 Nov 2020 01:00:10 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id x7so796823wrl.3 for ; Thu, 05 Nov 2020 01:00:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=OC9aACGGqpKEo7MnuaDGqRBy9T/1FYSfYU5LJ+QJCl8=; b=iet3rID42HqMn/ztHv9eczOUGQRszWGQ4gTxGQMciIqMK+4ZPQwPczqI+p4wnA/cls 3KMpzJRDwZTGeHEAeQVc7BwEYhYUIfRfgnb+QwIxCfjpzgRfhgcyu4G7eAawtxEQrieT I7q/vTtpaF+Y+FefNaVDFIGfJ5CUMcwQgjKNB1eY/YlQtu6cVWya4DsiQakJEJxQjlfG +0UUkxOV2E7+IlHLR4NPuAESrUTjFXcofSoMWk3L1njZdLJ1bmt9NX1bNEjCmWtPVjN1 3UBHONZSsQ3NQv9FyTFCvxkK0ZjfbtpubblFmrhhGCgdn9Sj1TqFUfzZTRiTbzbBhD8q B0kQ== 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:content-transfer-encoding :in-reply-to; bh=OC9aACGGqpKEo7MnuaDGqRBy9T/1FYSfYU5LJ+QJCl8=; b=MLiV1GLIUNv2fSUvdKPY5jvUyBwXKmeJRuI2dqUbYhd8H+en2lPBshbGic3fYHmiVP XrkQWB1vngeQJqwoOIrsjU6Lc2IpDyTs5acS5xLuyEFx3mnms2EdHzfZ7IsZK6XfCjrw dvwQnKJxGiAiF/1PP8iJHwlEJYGqGvuUWQ7WWL3+ZfIRp4t5kM07gFVWMHGCcSYbKHos Ww635/rk0V/RUDJkcFZXg1eniYjSNKFQIwMNHYcWyK60Hw6fRqfVrdIOCeKm8l4+Q//i 97gzNM9eXBaXx6FeKSgU0kFCsxhJPiCdvWeS3ejQQ7bh5Fh4tLexI44MhCx78/TP4Ym8 Cu+Q== X-Gm-Message-State: AOAM531B/t1cfeEwzMFD5349+ajpjy2mUS0JUIOaNz+cTvAJfn+x7N8g tFf0ElLl6kt0igBLavRs3MxsXQ== X-Received: by 2002:adf:f185:: with SMTP id h5mr1679324wro.10.1604566809726; Thu, 05 Nov 2020 01:00:09 -0800 (PST) Received: from dell ([91.110.221.242]) by smtp.gmail.com with ESMTPSA id g23sm1567257wmh.21.2020.11.05.01.00.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 01:00:09 -0800 (PST) Date: Thu, 5 Nov 2020 09:00:07 +0000 From: Lee Jones To: Jiri Slaby Cc: Christophe Leroy , Greg Kroah-Hartman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Paul Mackerras , linux-serial@vger.kernel.org Subject: Re: [PATCH 34/36] tty: serial: pmac_zilog: Make disposable variable __always_unused Message-ID: <20201105090007.GE4488@dell> References: <20201104193549.4026187-1-lee.jones@linaro.org> <20201104193549.4026187-35-lee.jones@linaro.org> <445a6440-b4c8-4536-891b-0cefc78e5f57@csgroup.eu> <20201105083626.GW4488@dell> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 05 Nov 2020, Jiri Slaby wrote: > On 05. 11. 20, 9:36, Lee Jones wrote: > > On Thu, 05 Nov 2020, Jiri Slaby wrote: > > > > > On 05. 11. 20, 8:04, Christophe Leroy wrote: > > > > > > > > > > > > Le 04/11/2020 à 20:35, Lee Jones a écrit : > > > > > Fixes the following W=1 kernel build warning(s): > > > > > > > > > >   drivers/tty/serial/pmac_zilog.h:365:58: warning: variable > > > > > ‘garbage’ set but not used [-Wunused-but-set-variable] > > > > > > > > Explain how you are fixing this warning. > > > > > > > > Setting  __always_unused is usually not the good solution for fixing > > > > this warning, but here I guess this is likely the good solution. But it > > > > should be explained why. > > > > There are normally 3 ways to fix this warning; > > > > - Start using/checking the variable/result > > - Remove the variable > > - Mark it as __{always,maybe}_unused > > > > The later just tells the compiler that not checking the resultant > > value is intentional. There are some functions (as Jiri mentions > > below) which are marked as '__must_check' which *require* a dummy > > (garbage) variable to be used. > > > > > Or, why is the "garbage =" needed in the first place? read_zsdata is not > > > defined with __warn_unused_result__. > > > > I used '__always_used' here for fear of breaking something. > > > > However, if it's safe to remove it, then all the better. > > Yes please -- this "garbage" is one of the examples of volatile misuses. If > readb didn't work on volatile pointer, marking the return variable as > volatile wouldn't save it. > > > > And even if it was, would (void)!read_zsdata(port) fix it? > > > > That's hideous. :D > > Sure, marking reads as must_check would be insane. > > > *Much* better to just use '__always_used' in that use-case. > > Then using a dummy variable to fool must_check must mean must_check is used > incorrectly, no :)? But there are always exceptions… Agreed on all points. Will fix. -- Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog