Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3298718lfo; Mon, 23 May 2022 01:03:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkncf5hVIdCZIoRyhhLJoV1G3h92s9viHj0ifRD+WhUI/p9wWQecEpyt4246DtTVG0uMF8 X-Received: by 2002:a17:902:ea83:b0:161:ed68:475a with SMTP id x3-20020a170902ea8300b00161ed68475amr16831376plb.69.1653292998690; Mon, 23 May 2022 01:03:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653292998; cv=none; d=google.com; s=arc-20160816; b=ahtFlXvsLWphrfY/drMS2tn6ZgQslT4yt8COdkX7PGERTmfpPf+cB+n8yb15IozgDc S4EY3YbDys4EQ4aJPXrtSMWlXPDTks34StDzYX4nEk6kguIERLg2U9KRCMLv6TVu6J5p bn17LYbZOt/UD4HFyVGdVufygYE71/l8SAoQiC6sjiLtTcJc7P7BslImobhx8KUsVNNm QWbLJWlfNLJGjsxcbXOUEF0DA48fbRtHvNs4DzjBhP7c1gbWJgXMhVO9gTT/6CloE/60 hLUa46Ao6n2ncZ0zrMYGNqd4PgGqZwild4cgs+7vsgdbpKZ0YsVo8SidijruiEr3BQVT ZuSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:sender:dkim-signature; bh=EhB/lv0xrW5Gf8DJlfv+KquZ+GUpeG3dg1zB16zvTWY=; b=iY8sSSg34j5uyNgx1e20lQSJUr7jFos+9PZUFL4p4FiPBZjqzjSyDDKkTE1euY6I/C J2AMJKjgZrNnr1J7hOoDiEVv4RQl+L2cmm+subHuk+SpVlPcQtTnXlMweVOxadFIecf6 yX8B2EusmUNGoBJ7SqYZwkw+ioRwY9u60dyeHUqLEClModn3FVFkQK/UucgSAjHUVVBV 5gWFRe1Hzg16kkMEfnORqQGRLRV4oGvK0qsWJt00Y4r41Wowtv8ZV39EtIAWUKMJdbkS xxuk2pAS7bGYy8mcYrOmfop3osj/AnToNKZ5JH7uXftyB6S/0S+lL/ztEcfnh+7awttD bJ9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QnVwIWj3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id bc8-20020a170902930800b001614094bfdcsi8959458plb.596.2022.05.23.01.03.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 01:03:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QnVwIWj3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BEFE111CA22; Mon, 23 May 2022 00:02:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351105AbiETPwc (ORCPT + 99 others); Fri, 20 May 2022 11:52:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350066AbiETPw3 (ORCPT ); Fri, 20 May 2022 11:52:29 -0400 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4AF115FE05 for ; Fri, 20 May 2022 08:52:27 -0700 (PDT) Received: by mail-ot1-x329.google.com with SMTP id v22-20020a05683011d600b0060aeae0b599so2475848otq.0 for ; Fri, 20 May 2022 08:52:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:content-language:to :cc:references:from:subject:in-reply-to:content-transfer-encoding; bh=EhB/lv0xrW5Gf8DJlfv+KquZ+GUpeG3dg1zB16zvTWY=; b=QnVwIWj338v0R9Yd4Lfmvj9Ay7nt1uNCKkpcLOoISy5VgilCmjqCAWQglpNwtSQAa8 CCDWDWsBE9iOGzDN10EUuWazb0nKKu8fw7ogTqXFDt4BYz9KtrEJHSgFtHRis1Je82PA 7VWrx0oPQf2L04S5h8I65b+vif08qSVT9Wj8yNcpJqBYSZ/O/JesHxJ/47AKqsM9apCE mhZld7fAqIx+ra7agM6xCCNOy2qzEgQV4qxSzopSekQ/93F9i9YbZGcL9JRJsbukmlb6 U4Q57XgMzguK9BhALYV7mVXe8NsSxNKyOxyTz5d7G5zMY/Nbg64LlTYBOXTFny1e3Skt nVJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:subject:in-reply-to :content-transfer-encoding; bh=EhB/lv0xrW5Gf8DJlfv+KquZ+GUpeG3dg1zB16zvTWY=; b=JV8GhKds71ZFtVyLzl2H1uyE7R25TyNBMut8k1nG+cZceW2JwOkleh7v4z3uXES+fk Lrey/dMw5XZzRkXtuOQfRxd+1JPl4gFRJeoz1bl0pVrvLP2MsAdcX3eQvIxD5Ls7ib5J DYIvyao6smXjJjXFZcOhrYT66U9t1Bp4yP3MKYxOx0ngQX2F4kU452oAHJ8qPzhieJbX 3/AAYR+9gepGhZeyjwT7KDOFaFZg2rmtDwl4vmVkbZmNMsEMaDmwougUVvONBnlaO4Zf p+/aZyk0PMaCRnsHmXIaACryNz8xVanxulbBay9oGtIM1BjpAFPTudYd1td4R3nJzuMO H8QQ== X-Gm-Message-State: AOAM5305xr59t9J15eT9fYoFVzXrdwJ8+g3odWMrwzhbkyN/neQuh0My 6RDXLxXMXVBgU7IshseJtqG+Kb7igk+hHQ== X-Received: by 2002:a9d:6e5:0:b0:60a:efd6:96b8 with SMTP id 92-20020a9d06e5000000b0060aefd696b8mr1555198otx.11.1653061946398; Fri, 20 May 2022 08:52:26 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id h1-20020a056870a3c100b000ee3fdcb51esm1069146oak.8.2022.05.20.08.52.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 May 2022 08:52:24 -0700 (PDT) Sender: Guenter Roeck Message-ID: Date: Fri, 20 May 2022 08:52:22 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Content-Language: en-US To: Geert Uytterhoeven Cc: linux-m68k , Linux Kernel Mailing List , kernel test robot References: <286a1eef-e857-a31f-839b-00a4c835dfa9@roeck-us.net> From: Guenter Roeck Subject: Re: [PATCH] m68k: atari: Make Atari ROM port I/O write macros return void In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/20/22 08:07, Geert Uytterhoeven wrote: > Hi Günter, > > On Fri, May 20, 2022 at 4:52 PM Guenter Roeck wrote: >> On 5/20/22 07:32, Geert Uytterhoeven wrote: >>> The macros implementing Atari ROM port I/O writes do not cast away their >>> output, unlike similar implementations for other I/O buses. >>> When they are combined using conditional expressions in the definitions of >>> outb() and friends, this triggers sparse warnings like: >>> >>> drivers/net/appletalk/cops.c:382:17: error: incompatible types in conditional expression (different base types): >>> drivers/net/appletalk/cops.c:382:17: unsigned char >>> drivers/net/appletalk/cops.c:382:17: void >>> >>> Fix this by adding casts to "void". >>> >>> Reported-by: kernel test robot >>> Reported-by: Guenter Roeck >>> Signed-off-by: Geert Uytterhoeven >> >> Reviewed-by: Guenter Roeck > > Thanks! > >>> Removing the casts instead causes issues with functions propagating void >>> return values (return expression in void function), which BTW sparse >>> complains about, too. >> >> We live and learn. I didn't even know that this was valid syntax. > > I knew about the syntax, but didn't realize immediately why it was > done that way. > > Initially I thought it was some relic from the "always cast to void > to make it clear you do not care about the return value"-frenzy, which > are inside Linux visible mostly in the various "(void)acpi_(...);" > calls. AFAIK these are checked by some external tools. > In Linux, we have __must_check to annotate the important cases. > I looked at the output of my coccinelle script. To me it looks like (almost ?) all of the code with "return f(...)" in a function returning void is just sloppy programming. In case someone is interested, I attached the script I used below. Guenter --- virtual report @d@ function f; expression e; position p; @@ void f(...) { <... return e@p; ...> } @script:python depends on report@ p << d.p; f << d.f; e << d.e; @@ print "Return in void function %s() at %s:%s: %s" % (f, p[0].file, p[0].line, e)