Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2384265rwb; Sat, 24 Sep 2022 07:30:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4zsyqebFCkNuhgHyr2iVUw7kjVt6m0eds8r62zf9IfeFC1Xr8V1u4MN0anY3z5egw62x2U X-Received: by 2002:aa7:9801:0:b0:553:1bfb:9669 with SMTP id e1-20020aa79801000000b005531bfb9669mr14335669pfl.15.1664029829554; Sat, 24 Sep 2022 07:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664029829; cv=none; d=google.com; s=arc-20160816; b=C19kG8HDoDgm41ynjgTHpWod+Zch8RU+LSvpokGfMrrdVY5AhI71Qbr7oEfEQ74B+/ wUQOZbf0N7NlFpyl7xEF7riaTvGFlje65PH9ijATYujONd9rJwg48+kgDSBY7ceOyGuo MsC+9DHCK3vMbq/nbCy5GPlZeMPY9X2ZcPPrqdmww0GwPke6hSuGt36tS3zMqFcenER1 y/qcjJTiAkSKvYd7R1iCnwsd0G1XR9eAy9ALJlNWAbh8SMJoH99PZdunKakjFg8IMQny uOB/tko7PgmE6JZc6Syq40vShbO8Da4z8JK4+WQw25gc5N5XyOQbcfFCouaQG4b9Teie 6PPg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Dn4BaAAf6g47yg5KtepA+oD9RGRtq2gD3qcSNeuzRPo=; b=gOYS15iBmIpzdyNnLS3GeKXkTF6/S9wtb3O3Hcdjj6yKPPb20bdAKvpDRJ9wuEg5HS MK1fwmQSXAOFzrvbS1nzKvUETKiDF+JFASnXEtWZpUpk4ztQne7AG5QQcGqDVyU9NGvn 2wQmZ2ci7oDTiO003VWtse7h70lgi7ptkHNpKaJIFUKHkf4fVGg6OUpkVl7K58vvuWzt 3fzdcUw6d8V/fZXvMcwwLA6rzmIs4+4L0HGh3KxR9jvdo6O9iOHieakUFi+PsZF9ySBB maEu2RY61PcY1ZoahIbI2741gT5G1KgCHOKN/f+HO2wfXPh73VuvjA9SjgY7sQnQEmOK ME0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020a056a00159100b0054875fd979bsi12911568pfk.216.2022.09.24.07.30.12; Sat, 24 Sep 2022 07:30:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230117AbiIXOSQ (ORCPT + 99 others); Sat, 24 Sep 2022 10:18:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230168AbiIXOSN (ORCPT ); Sat, 24 Sep 2022 10:18:13 -0400 Received: from isilmar-4.linta.de (isilmar-4.linta.de [136.243.71.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1200EE9CEB for ; Sat, 24 Sep 2022 07:18:12 -0700 (PDT) X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES Received: from owl.dominikbrodowski.net (owl.brodo.linta [10.2.0.111]) by isilmar-4.linta.de (Postfix) with ESMTPSA id 35655201362; Sat, 24 Sep 2022 14:18:10 +0000 (UTC) Received: by owl.dominikbrodowski.net (Postfix, from userid 1000) id 8D8B08064C; Sat, 24 Sep 2022 16:06:15 +0200 (CEST) Date: Sat, 24 Sep 2022 16:06:15 +0200 From: Dominik Brodowski To: Arnd Bergmann Cc: Souptick Joarder , Tony Lindgren , linux-kernel@vger.kernel.org, kernel test robot Subject: Re: [PATCH] pcmcia: Removed unused variable control. Message-ID: References: <20220725012955.4928-1-jrdr.linux@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham 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 Am Fri, Sep 23, 2022 at 08:58:47AM +0200 schrieb Arnd Bergmann: > On Thu, Sep 22, 2022, at 4:39 PM, Dominik Brodowski wrote: > > Am Mon, Jul 25, 2022 at 06:59:55AM +0530 schrieb Souptick Joarder: > >> From: "Souptick Joarder (HPE)" > >> > >> Kernel test robot throws below warning -> > >> drivers/pcmcia/omap_cf.c:127:7: warning: variable 'control' > >> set but not used [-Wunused-but-set-variable] > >> > >> Removed unused variable control. > > > > From a code-generation standpoint, this is obiously correct, and probably > > the compiler removes that omap_readw() already. > > omap_readw() is an 'extern' function, so it does not get removed. > > Even if it was inline, it's still "and volatile" read that gets > left in because it may (and probably does) have side-effects. > > > But, to be honest, I'm not > > perfectly sure on what the device expects -- and whether it's required to > > write back the control register (or parts of it). Does anyone still have the > > hardware (or specs)? If not, I'm tempted to apply this patch on the basis > > that the compiler might remove that omap_readw() anyway. > > I think assigning to an unused variable was at some point needed to > avoid a compiler warning because otherwise omap_readw() was just a > pointer dereference. The safe way to transform the code should be to > drop the variable but leave the function call. > > Note that the driver is only used on the 'osk' reference board, > not on any devices that were in mass-production. Thanks for the evaluation, Arnd! So here's what I intend to push upstream: From: "Souptick Joarder (HPE)" Kernel test robot throws below warning -> drivers/pcmcia/omap_cf.c:127:7: warning: variable 'control' set but not used [-Wunused-but-set-variable] Removed unused variable control. Reported-by: kernel test robot Signed-off-by: Souptick Joarder (HPE) [linux@dominikbrodowski.net: retain omap_readw() call, as it might be required] Signed-off-by: Dominik Brodowski diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c index 1972a8f6fa8e..d3f827d4224a 100644 --- a/drivers/pcmcia/omap_cf.c +++ b/drivers/pcmcia/omap_cf.c @@ -124,8 +124,6 @@ static int omap_cf_get_status(struct pcmcia_socket *s, u_int *sp) static int omap_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s) { - u16 control; - /* REVISIT some non-OSK boards may support power switching */ switch (s->Vcc) { case 0: @@ -135,7 +133,7 @@ omap_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s) return -EINVAL; } - control = omap_readw(CF_CONTROL); + omap_readw(CF_CONTROL); if (s->flags & SS_RESET) omap_writew(CF_CONTROL_RESET, CF_CONTROL); else