Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp326652rdb; Thu, 8 Feb 2024 07:07:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXEvZS6oKrcAyzpqLnoUS2nSijSThObxq6YLBteWsczTkh3GIFAOLW+QUgZk/0uYk+h54ysiBUhSVHPBwWIhIJFFlQ7SeJk2vlqrPAf9A== X-Google-Smtp-Source: AGHT+IHFCgstV/RQi4iP5NyEfQZaIHh+Icht+OLTuZJjyhIec4qRegFxyhhmRp9CuaU5+QIuXE1n X-Received: by 2002:a17:906:1ba9:b0:a38:981c:840e with SMTP id r9-20020a1709061ba900b00a38981c840emr2850177ejg.19.1707404876248; Thu, 08 Feb 2024 07:07:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707404876; cv=pass; d=google.com; s=arc-20160816; b=F3D/Ha/U9plQq7xbiqZb8wIpC+Cg8Ogt1XfE6m3VWpdTyTUL4jo3XdZsPtz+JMLaQn 7OZk45JUJtds1doy2hPsTpFcJ1En+QR+B0uGuO+KM5fX96N3cmqZo4yphh6MPKlaeD+0 2dfh4nrgj8UMDmE27r9wGNTDVf0iHLufLH+sSbMCUCRY/ddl9BNLgsVfFkPl6cY02bZH kI3pbzmK4Xw8UHFtTbgAl1HLOyOOClh7+GV8RhYT10ajsxrsdMjXe7hQdVXYGqDydWdU pRHUyVImxh4bvaL2a1cZ83y2J/bl/B56Xm/BZFv9QD3wa48lBrUM3GIkRTGdu6RGdjld gE6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=MEXn0Pkjye0UsAfRWO1sP+a/rfWIwp8KQzaA582+tKs=; fh=HmkNGKQcpg0emeLXfF90741RIWvzhegclAax5BEaaUg=; b=P2qO6ez0O5R2k+vg/G3dbQoqDCN3N4Zffk0zi/DGpMK6QhfOub2oQDlSEsTMBfNQzE Kh8uT42LEvnTSjjGPpKDGYOXCNkg46KBQ5xHjisNn4Z7vShyU+B7EsK60tlVCpjMpo6A HM4VXuMyjRHhfsXyGrqOZySWROqzOpF9qaA4R9IeSwb7hSCvFxFCE+sr3ILP6IPXu9fN wy9MCeEE+pd0gMoxPNfeFDIzcsnjWDI0dVZFxgwvpkQEsVe8VNOAGzwAo//2imvzX7ob 1Z24sK5ZmS6jj/2lROZooIP8cimqSfGhdunBWtDZMR1HKxoG56h2vrluSZ/P37qVqDCn G7Ng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=JdObgyMB; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-58266-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58266-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=2; AJvYcCWlCZwGSbBa+GbB17A/xfByEFDyGpBRvmmTcdFWlz9Lqy5e8eyqdu/BQA48AmIH2xDiOAqkNiya8bGxGdu3eful7Lu3qoGtoVeOnWRAEg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id g11-20020a17090613cb00b00a3672af1261si120950ejc.743.2024.02.08.07.07.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 07:07:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58266-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=JdObgyMB; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-58266-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58266-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E736D1F22772 for ; Thu, 8 Feb 2024 15:07:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A6E576C61; Thu, 8 Feb 2024 15:07:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="JdObgyMB" Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D0BA7AE69 for ; Thu, 8 Feb 2024 15:07:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707404864; cv=none; b=Lmagz4/phs5O4eQH3Jk8hKyIH9Kaoy9sJFWYMcU034hG+ddU68qL/ZdfG3sX+lPziU2zjp67fklh4Kh5xSV4oQQ2ROMQdF/lx1YejaP9xBA6/DwDO54QP3MyPAFfQVqoynf8+0bQsPacXsICO2PL3qrKYKJ6+6ROq7srRDRd3+U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707404864; c=relaxed/simple; bh=vwlIGebp9eqQ5DRFfzrUQ8c5/g9Lkk77ZHifsoM1IQ8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=BL9eP9PGP16b1uGnuJFIUcpNMJAQZVlJ1U/f3/kBcPvNl2ysDtWsTNriYinhCbHKQ4ZIgRHX/7uvUwSfaFnroTeVsg4rBjhtjv+4j2WAkCp69dztzUCmZmuHmk/DK5OzD8jEhdYvtMmE2uW5O7X+HYkF9Y0X5HTjxV3bQudrDLE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=JdObgyMB; arc=none smtp.client-ip=91.218.175.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <1b4f32d0-a203-4c97-94e1-93ec40364c3c@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707404859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MEXn0Pkjye0UsAfRWO1sP+a/rfWIwp8KQzaA582+tKs=; b=JdObgyMBJvjT6YNZYxdVFzbfirnDaqCbzaCYACuKKdJXHvDtwUzzgAVpsB2VUbZxr5Ad5x LOYOZRwyQ6hw+bKNyiizEBKDwp4Bt1mZfb2k5ZnnFw3+jFH66j6QFkfkcb5Owbsz+sXeZa iuzK4/abkW25LW6wQNM+9Cxy5SHXFUk= Date: Thu, 8 Feb 2024 10:07:27 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH][next] drivers: net: xgene: remove redundant assignment to variable offset Content-Language: en-US To: Dan Carpenter Cc: Colin Ian King , Iyappan Subramanian , Keyur Chudgar , Quan Nguyen , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240208122012.2597561-1-colin.i.king@gmail.com> <4e0d27a6-37be-4b6e-a60e-508bcb0884cb@moroto.mountain> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Vadim Fedorenko In-Reply-To: <4e0d27a6-37be-4b6e-a60e-508bcb0884cb@moroto.mountain> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 08/02/2024 13:40, Dan Carpenter wrote: > On Thu, Feb 08, 2024 at 12:39:24PM +0000, Vadim Fedorenko wrote: >> On 08.02.2024 12:20, Colin Ian King wrote: >>> The variable offset is being initialized with a value that is never >>> read, it is being re-assigned later on in either path of an if >>> statement before being used. The initialization is redundant and >>> can be removed. >>> >>> Cleans up clang scan build warning: >>> drivers/net/ethernet/apm/xgene/xgene_enet_cle.c:736:2: warning: Value >>> stored to 'offset' is never read [deadcode.DeadStores] >>> >>> Signed-off-by: Colin Ian King >>> --- >>> drivers/net/ethernet/apm/xgene/xgene_enet_cle.c | 1 - >>> 1 file changed, 1 deletion(-) >>> >>> diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c >>> index de5464322311..8f104642897b 100644 >>> --- a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c >>> +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c >>> @@ -733,7 +733,6 @@ static int xgene_cle_setup_rss(struct xgene_enet_pdata *pdata) >>> u32 offset, val = 0; >>> int i, ret = 0; >>> - offset = CLE_PORT_OFFSET; >>> for (i = 0; i < cle->parsers; i++) { >>> if (cle->active_parser != PARSER_ALL) >>> offset = cle->active_parser * CLE_PORT_OFFSET; >> >> It looks like more refactoring can be done here. >> "if (cle->active_parser != PARSER_ALL)" is static, no need to check it inside >> the loop. >> > > You still need to check... I don't really think it's an improvement. > > regards, > dan carpenter > > diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c > index de5464322311..61e31cc55771 100644 > --- a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c > +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c > @@ -733,11 +733,11 @@ static int xgene_cle_setup_rss(struct xgene_enet_pdata *pdata) > u32 offset, val = 0; > int i, ret = 0; > > - offset = CLE_PORT_OFFSET; > + if (cle->active_parser != PARSER_ALL) > + offset = cle->active_parser * CLE_PORT_OFFSET; > + I think we can add "else" here and avoid the loop in case of != PARSER_ALL and avoid "if" in the loop, wdyt? > for (i = 0; i < cle->parsers; i++) { > - if (cle->active_parser != PARSER_ALL) > - offset = cle->active_parser * CLE_PORT_OFFSET; > - else > + if (cle->active_parser == PARSER_ALL) > offset = i * CLE_PORT_OFFSET; > > /* enable RSS */