Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp270335rdb; Thu, 8 Feb 2024 05:42:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV6obRKqifbLZ5IbP+9Dm5G8R77focwUNMbUH0bXrHaEQQ6RTX/SPfjBsib0HV3/+iQeYEsD86QBF1Ue21CfDAS4KFXSyf0ob6AmzDquQ== X-Google-Smtp-Source: AGHT+IHlFSymHoGDgezpvJDj+6GUnxbrAV1+0AiBKyH/vq8qLJY0oCtbzAgeLcPp+wa8Q5MrcrlV X-Received: by 2002:a05:622a:2a96:b0:42c:b29:ad6a with SMTP id kf22-20020a05622a2a9600b0042c0b29ad6amr3955413qtb.31.1707399753132; Thu, 08 Feb 2024 05:42:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707399753; cv=pass; d=google.com; s=arc-20160816; b=CBnUHpQz2UisEMUk3ZdFm1/MrRciLBGglgt6xRy5STHf6zkGtjyeQOmJo5G7ENR6Ir OA0sxfe96FGayN7WSLQQn4gBtlpt3UvkRp1uzpqYzuG2l06yIy6kL2IuRcgcnTEN7w4a 29WbEOC3TH+v+QGEjQk6yO2k6z5/31Dt5TO5d2fa0pn+/+d7Av3QVmFUaV1F0fPc2wGj aJUuOK92g/6NOodf1pvXj870HkIIi+as3boKh048ViGW0tmwfuIXtG4KqMcIwjLHibGC aFZhhHFEGJiQMyPkOvvFaeT0WoWcCTJiqpClttvy+eoXocGXUYdJxgiWniFk7Nie7ezo rSlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rMpPbcaHJbhfuPySCuBDy0MbgTxIMiDJ4vzkIHlJDoQ=; fh=lt/X6WXHNTU2gtFlLDOcMDnOZz/hRq+Mze06AEktjFI=; b=amORszSgy8ir6SI4DaZrwSBxwM07zGLU1y1L3NMunwDGwmz2gW5ZFxoU0qEIt7Mzal fhgRiNz6n8reEx9DWIxY3IJ/qpxrvtWZAnDacJfSOUuTVOAb/eFLzZhLfnFqewotsgFw V5vXMUctYDT4iI0zdzUqmenMtF64ARvUvw8kqt03X2Mnqa20D34F8ue7B3f0lTqwqKmr w8fuuuhoDkOXDR2vs3S7erBjMa3aahZEt2IK4d45/K1EgbaKZoRuUEKHbBckG7JjAZMn WVQAh+vrKl1wU8W/uNqeJ+PWpYcUA+KczQ3fM1N02Yks5kJBytfkvLKikz9cOn/e/5Rt GZ0A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ClU67nOl; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-58165-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58165-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCVmDRFh9ppfjfO4AOl5+AzvOEl6qDgieVq4mxEtZ7wa4478zrJwvftY72b9Emmuv8bNkilMOY7p7DrDjgBfxkzktXCXji+UzjtwddNpBw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j11-20020a05622a038b00b0042c5024c011si3596qtx.655.2024.02.08.05.42.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 05:42:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58165-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ClU67nOl; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-58165-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58165-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 313741C27287 for ; Thu, 8 Feb 2024 13:40:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E217F76C96; Thu, 8 Feb 2024 13:40:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ClU67nOl" Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33C8E763EF for ; Thu, 8 Feb 2024 13:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707399614; cv=none; b=keYrXAe7RvHYmDSsvFpwqpd7plQNJe6lrVUpj+lC7IYMSFz0U7jWMTKgvGynqvIYHrKIm5Ifs5Ja1ZH2uKYuBM5Gk9ENuj0CfwHLI3HlMj1tEHzdIRIdJH6PQnIhe+/DqqBv+Yl3GSiNZbFnz4beSfdQOqrvoU4LSDVcmj2MKaw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707399614; c=relaxed/simple; bh=tdtjhu5OUzycn48SWzt6cXCTR3DvhpxDtc9LZ4VxUCc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VGWxhLfo4Mo8rUZFbhqOncdqRg3ZlYE0xw317aL9oILeR5Zy1+JzgGOSvwBJyDCAYXbuq4YQIJo/473aHbE70Z08r2nZxL9rO5iYchgkYDtmEvzX+lYrRZhBdjkTr1WArxlthVzGPVYwpMpOcOBQHkeW0459SFUDSxYqcB3SgWM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ClU67nOl; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-55a035669d5so2396066a12.2 for ; Thu, 08 Feb 2024 05:40:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707399610; x=1708004410; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=rMpPbcaHJbhfuPySCuBDy0MbgTxIMiDJ4vzkIHlJDoQ=; b=ClU67nOlxFpVUFwk2DavZ6JwDViVmFFjjnidw/di2DqucDpZVTjqaN7Ekq8q1S38rq GjwbHO6Fuo2fYtHeOspKynkJV7Knpp2l9/ZvNFw8qGy8bwayRS+PyF9ps2tUVsSAgRDZ ecDVC+KACGt9hS4fiSLmjghKyO5wO1q7jSEhhAQaMsuH10sUPyuzD3euGsx5m0uDL9Zb UQKC3fjSlRO7Bgr6x74IrVWjcMfjb0adjchnp27DlWNgKuCIB//tGx/PgZd1uQNnqC3K Xo8NjZuZXQO4U1PZ0VvZN17vEnhNsZfLvgT6cRqK/I1jvn/EBcX9WaPG8t2tTl0qe+6X b8vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707399610; x=1708004410; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rMpPbcaHJbhfuPySCuBDy0MbgTxIMiDJ4vzkIHlJDoQ=; b=ngv/SLqmAGyrr+IYioRUC4DWxWNZyXzhbHUWSn5HiafnS8bFX0j31yAUAH5UZd2oOL LtkHlcnbSUkN6KeAezlwh++ede8GjGTD3i+tQvGbjE7nxOZVAS+EzEbtlKcDfjKLBwBO W1QguvtRsx9qS/PVbSnbmI/C5qPvQJxjExCIiYfhSwikANeMfoiIvbTq3Q1ZJ47NbLOn h5zVBJ/g7H/feh4WO7VTtzjPPzTk4E5x3QurrJlFAXZr58ZkSLl8ICLrKNoYTO5LBCk2 ophwIjwrcTmNutHBErVeX0ix8k6oiR9h39rGpioqgCZw0JAXttohsFCx9LmXsOila4xi E3xw== X-Forwarded-Encrypted: i=1; AJvYcCXn8oPj07sqgBHiPxyUyurF941jpVXv4wMgnkH4mSOdB604HrfMoCYTxZGhjLcrfYNElMRJbNd22mW6azcapJWvcRy3HEczSEERb8P5 X-Gm-Message-State: AOJu0YyWBEPSftZFhItLtVpxwufNNlhBSJ7jnRO+nwvzOMhUFQ2Pp+at wdwMVEdRCupUGMhBHUywfexJ8TjO+seLzMpfPBsUqpRd/6uG+n/zJ9czJr+YIVw= X-Received: by 2002:a05:6402:1acc:b0:55f:fe4e:9cff with SMTP id ba12-20020a0564021acc00b0055ffe4e9cffmr6456099edb.32.1707399610400; Thu, 08 Feb 2024 05:40:10 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVV9uetxIHH91qoKcZ75DzSamDWKmrGYLt6ElrWIM3OMrjWUZZRZlXBYKoBnPdPXI1/5u0515bONx4HcuggJTEGblEprdXFO10X1PgtfXTbOwuevasT7nqkPaDPuQVLTxeB+4OI52aP9MsXRyNVNvaU/vX9WrhMsittHBWGZ1k7G+2DJB2RaWV9TDrhy4HAavFyqK/CYw8vC82BBXpSg7SJRPjykwsvKRPwETwJiC8XK+R40g+B6R52/Um6zz9c3lH8dt/DUcuSbcQg4cBktePu5vYIR5NC87e+ShLzCxysDmU6pv1DEwCWKQFgcCOJr8YpQsj3Po861+eIKyNgNjxLwCTpv2F6NFRde/D+HBJyGIq7hSf2375KNckO9jEUk8Kw8hQ6hDzxsNarnRkr5oWYsPEe3kzIxFmzsh0fVF+EUd9sRD0l4OqZ Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id q17-20020a056402249100b005598ec568dbsm819294eda.59.2024.02.08.05.40.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 05:40:10 -0800 (PST) Date: Thu, 8 Feb 2024 16:40:06 +0300 From: Dan Carpenter To: Vadim Fedorenko 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 Subject: Re: [PATCH][next] drivers: net: xgene: remove redundant assignment to variable offset Message-ID: <4e0d27a6-37be-4b6e-a60e-508bcb0884cb@moroto.mountain> References: <20240208122012.2597561-1-colin.i.king@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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; + 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 */