From patchwork Mon Jan 8 09:07:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 185858 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp905620dyq; Mon, 8 Jan 2024 01:09:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFCHYULXGE1Vvho6YuvcTS15Dn05ASh5KQOLDO2DVk+7JO9H1bZHi9E9mRY2BXERSDQSBz3 X-Received: by 2002:a17:903:245:b0:1d3:f02c:e82a with SMTP id j5-20020a170903024500b001d3f02ce82amr3889309plh.36.1704704965340; Mon, 08 Jan 2024 01:09:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704704965; cv=none; d=google.com; s=arc-20160816; b=hWjN+i7hihCzaMRBHMyPVFjOsP9gXA8UzmE6jVfasdp5/4bWWQw3ophiqbLI/0zfGW IEtybEn8PZTT/U3qoZZg7QLjLCLmqlen081hkdPzaRVGnnvssSFF2jxG2uxolg3M9DMc oRyHtv7lU6YGFOFgui3gaOu+q93cNKjGQroX8IL2poeTySWl4JF87yz1Px/g6vFz6qN+ ufFXZiU9khz2yuWbyoOfimp70kxADVJsRCnWuTHB4ZyQykhzHQPeeOYKViucLuhuyXPJ Wx4g0aeQS33fPsi6i2TX8ezZOKLatjUpYt8tCoRzDdfLjxIqvctaoYYyX5ia2pgI/pFW V2tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=4UdLGAH7mAUfR9yXCWKCpw7UbYKtkDbnESY38vkxFL4=; fh=IdcYQNVrZnbXzC/z9Tuow4IZ1RPDuZ+T15ALMDkZV7k=; b=Uyll7e5nnuxTHmL7B/O2SlOv6ebi++lMxLfyvy0kKqUcarXCc0JF4MBWtTzvehn6Vj bXj81PtenO1X87QXvbYRdWM9ytXaR8IzGMTM2XqUv/Un7+x7g8AP5Z84RVogQ455pTj/ +CjCLZ2zfyNVhsIpdcG648+JDTq5oi07JSfzn5KWzcJ0vds7Nsx96+x/d38LNP4S6rnK 3af9GbdsPr7aJ9pgaHrRFokmI4OZ98dcwUZ2HWhdprcAvEUvrvG/QcZmSMlUpzTP4keQ 21Fm3y/exxBH2BhBzKBfpY0SNicxvXYu9CisUXmDq9Yua3iZeHIzEjuq/NCwG8chY8dS YTww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GmV1m/Wb"; spf=pass (google.com: domain of linux-kernel+bounces-19244-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19244-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c8-20020a170902b68800b001bdd0d0530dsi5597626pls.129.2024.01.08.01.09.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 01:09:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19244-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GmV1m/Wb"; spf=pass (google.com: domain of linux-kernel+bounces-19244-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19244-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id CF646B21B71 for ; Mon, 8 Jan 2024 09:08:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BFC5812B7C; Mon, 8 Jan 2024 09:08:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GmV1m/Wb" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 9F81611C86 for ; Mon, 8 Jan 2024 09:08:04 +0000 (UTC) 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-wm1-f52.google.com with SMTP id 5b1f17b1804b1-40e461c1f5bso8615345e9.3 for ; Mon, 08 Jan 2024 01:08:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704704883; x=1705309683; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=4UdLGAH7mAUfR9yXCWKCpw7UbYKtkDbnESY38vkxFL4=; b=GmV1m/WbhAuWKZBuQUCrM38Vy2EfZ+ZwlfLs6grsa7lT3HmuXwtXJE8Ahl9rxEWdC5 jaIEPTJRN56d74qbnpDwx4xoFJmut1Rz6Lo5P7q2q3iCMp+9309328VEG0YnRn+QLP1+ 02buYXqbbkrtboWa6tzh0/inTqmq4ek4Emr5+bIfQycpJ53XwX+V/g2FsEsao/4eGvqv 5au+TdA6IrOXlbBhXgnZ/SxH0qUchIZWNq7nnbKYJBge/x3S3SlpnGJlPl0DjWY7mROP 8DfV43S5Pplu/Dl+XPLynpT/qJMASIrk9qrMC4TUyIkvB1w/zC36yVrYCRoZqRH1NFAi bUJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704704883; x=1705309683; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4UdLGAH7mAUfR9yXCWKCpw7UbYKtkDbnESY38vkxFL4=; b=X1Q0Di/CRWRtiakBUT9m5YVNHtIkLTfz/eAAgY8j0gwJJQSP6BVfHHKoqIqutPbkJt zdOtHLUdgjucqPub8UurUb0ct+phhGdH3GYaYdgjTRPh453kIoimoHIg8VgPV4qow8nt FW54qvAPn2SWrbVWgkXoU3zVrWi3b1z6Wr8SbM6gwmvy2yGdFRaCgRNK3rTtzvrqapyx GCKWh0XesO5y7O0+VQOPE0pwWh3LGGpaZHCyElpfYd0jN4ukcT2GbWdgPikt1ZISLrgR 3M3Z3n4rIvFbvCw3NmmvPLjMoACv2gyUPjX3cc3RiNHfZc+KPtxKwoTzMWUNLJdbPD5B GGjQ== X-Gm-Message-State: AOJu0YzsPFT4RHVnuCqUr/roBQmf7TjoAivCp72jU/fgH9M3L30HtYS6 VdF01DCgHuHa6Wd1IvRHpGqDThC3JRJM6Q== X-Received: by 2002:a7b:cb8f:0:b0:40e:47a3:5e1d with SMTP id m15-20020a7bcb8f000000b0040e47a35e1dmr470518wmi.156.1704704882913; Mon, 08 Jan 2024 01:08:02 -0800 (PST) Received: from localhost ([102.140.209.237]) by smtp.gmail.com with ESMTPSA id l42-20020a05600c1d2a00b004030e8ff964sm10295482wms.34.2024.01.08.01.08.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 01:08:02 -0800 (PST) Date: Mon, 8 Jan 2024 12:07:59 +0300 From: Dan Carpenter To: Steve French Cc: Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/3] cifs: delete unnecessary NULL checks in cifs_chan_update_iface() Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787512713714727350 X-GMAIL-MSGID: 1787512713714727350 We return early if "iface" is NULL so there is no need to check here. Delete those checks. Signed-off-by: Dan Carpenter --- fs/smb/client/sess.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c index a16e175731eb..775c6a4a2f4b 100644 --- a/fs/smb/client/sess.c +++ b/fs/smb/client/sess.c @@ -467,27 +467,23 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server) kref_put(&old_iface->refcount, release_iface); } else if (!chan_index) { /* special case: update interface for primary channel */ - if (iface) { - cifs_dbg(FYI, "referencing primary channel iface: %pIS\n", - &iface->sockaddr); - iface->num_channels++; - iface->weight_fulfilled++; - } + cifs_dbg(FYI, "referencing primary channel iface: %pIS\n", + &iface->sockaddr); + iface->num_channels++; + iface->weight_fulfilled++; } spin_unlock(&ses->iface_lock); - if (iface) { - spin_lock(&ses->chan_lock); - chan_index = cifs_ses_get_chan_index(ses, server); - if (chan_index == CIFS_INVAL_CHAN_INDEX) { - spin_unlock(&ses->chan_lock); - return 0; - } - - ses->chans[chan_index].iface = iface; + spin_lock(&ses->chan_lock); + chan_index = cifs_ses_get_chan_index(ses, server); + if (chan_index == CIFS_INVAL_CHAN_INDEX) { spin_unlock(&ses->chan_lock); + return 0; } + ses->chans[chan_index].iface = iface; + spin_unlock(&ses->chan_lock); + return rc; } From patchwork Mon Jan 8 09:08:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 185859 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp905757dyq; Mon, 8 Jan 2024 01:09:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGvyrQ/HmM0NaKoQ36EOmGXg9xbJ447Wmd+U1ssISKK26Qj8AUwmZUdjZv4W/P4s71gyOai X-Received: by 2002:a05:6a20:1e54:b0:199:d0e5:ea59 with SMTP id cy20-20020a056a201e5400b00199d0e5ea59mr173264pzb.104.1704704988643; Mon, 08 Jan 2024 01:09:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704704988; cv=none; d=google.com; s=arc-20160816; b=Ii5/rgOkKeWnTUdGRji1mqEn9fJzT1LiU2xYRSI8mcmZN3Zp2mo54X27cMqIRijOLK L8twPHZSNc0qdkEkn/60N3AygpXGUJsRgUBNVpwILVMc84hkTvyYmV7n/Bnnn8TrL9yC wQP4uSzcKdQUWK1I9c31Zo3y1UdJJhDbf5O00Q/l9YQMniUjhVo1qHT80bMbs4mrt0z3 Xm/5H6CK2RiarqL2P5EPjTITIKVVmcvhHPyUsQY0bGymbLPmsSJK0Cp2oqwoFhimJdyz K+JPS/cB1jHaMbm46rpIpKWTk5dsywsEh9iAhdX/cOIvKDkudia6gYO0PZDXeJkXu++/ 4o7g== ARC-Message-Signature: i=1; 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:message-id:subject:cc:to:from :date:dkim-signature; bh=y29ZjWS+kMxK2hHYGSpll/bK2F92ct4CoCPibAWT7g8=; fh=IdcYQNVrZnbXzC/z9Tuow4IZ1RPDuZ+T15ALMDkZV7k=; b=orkN9TbJ8p9T6tPsxECz77d6Y8p1F9llIaite7V3u+pAXgcJOBolyf1K381hNF3YLO 6rTEDn7NApJ9/W1rLghvwQzm3YFXrAgwJp8OM5m8c93MY9gZ+NOkKWE2RVhkpwqMqV97 QXCSX04qEvm8R0KEzKkqkiySVLIh/YkB+mDGM6FAJsPqDjjL4s7MqRVeLhr9f0POqSeg vU2iZegDUlIcJrQVoLNP3u28gysacHVr5dVHCebxKaxo2z23m3jtmmYBo4/u/bR4YMJg lxWq3KceqcU6sAn7KIPt/yS8FKXVEZCqQCXJ5nthl/ZNwCXOf+KMihYqrpyL1Kh3UdIw zELA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="zOIaUch/"; spf=pass (google.com: domain of linux-kernel+bounces-19245-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19245-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p16-20020a17090adf9000b0028c4028a799si5368661pjv.111.2024.01.08.01.09.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 01:09:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19245-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="zOIaUch/"; spf=pass (google.com: domain of linux-kernel+bounces-19245-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19245-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 59A56B21969 for ; Mon, 8 Jan 2024 09:09:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F187612E7D; Mon, 8 Jan 2024 09:08:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zOIaUch/" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 A204B101F1 for ; Mon, 8 Jan 2024 09:08:34 +0000 (UTC) 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-wr1-f50.google.com with SMTP id ffacd0b85a97d-336c8ab0b20so1640771f8f.1 for ; Mon, 08 Jan 2024 01:08:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704704913; x=1705309713; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=y29ZjWS+kMxK2hHYGSpll/bK2F92ct4CoCPibAWT7g8=; b=zOIaUch/6Dq+YyeHYAy9WW0oNPnFrtRNLgfv5OxBMfSlFJIhvLUpGEpamyR3LO90Na bqPrakEwgFzCW/wPg97dB0wx6bdVixs8sLCXwBvszUMd5ZSwwdGgwpYXjojCvd38HSjh S4dmxe7VH2c5uoqEyO9APb0jedksgMc5iyrIAPJw7a2CHgo2j8i0SnbKkPLUIZshBQ4B c0S1seboX9JMV6ROsDKm2t/p3Ac2oLfu1rjaQCM0jpjnsZj0g9czeO753rBXk9v3qPAk Ou2ti5FjcwusRvk4McFQdd6tzEcs1BSxKUFGj9UrnjRPh8f61IELQZVr2573WhPCCTeM mUEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704704913; x=1705309713; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=y29ZjWS+kMxK2hHYGSpll/bK2F92ct4CoCPibAWT7g8=; b=TPt/ln42JzKne+vMzFv/YS9wKT8GwEEqAyzQEY1x5JTw0msfTQY1INKbmG9W4J8UmO BlY285y01juZApmQ/j4WJy1yUwVKAcRbsZpvYkXRtI6w+4I/EbT4/X18J4ZaoseD2msE hPP2vG/BDY/JeUntN/tWOGhxjlkiGI1WiB6GNm3wpRwha3pUdj9eyW8VdbxgwzwvcZU3 ANb04zad93dt/oOFOp2NZJmejeI4r4FoaK5rQNGs0e/8E3WH/B4VPCau7XsP6WlK4kP3 5PuqSHW26dU1eB/58Z0z0j52HjImT6l2J8es6AeQUZOHb1pW4MXa59wwmR6yHhEvkd8E EbSA== X-Gm-Message-State: AOJu0YxhJobYNJSHvn7mS3h7BkNiVJpTAAV+4dUUFgBOGawp8k8nQca0 BoJni3YVCYfctYtcT59LWI3xGQ4VyTG7EQ== X-Received: by 2002:adf:e848:0:b0:336:6db8:a00c with SMTP id d8-20020adfe848000000b003366db8a00cmr1329791wrn.26.1704704912925; Mon, 08 Jan 2024 01:08:32 -0800 (PST) Received: from localhost ([102.140.209.237]) by smtp.gmail.com with ESMTPSA id k4-20020adfe3c4000000b00336e15fbc85sm7227038wrm.82.2024.01.08.01.08.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 01:08:32 -0800 (PST) Date: Mon, 8 Jan 2024 12:08:29 +0300 From: Dan Carpenter To: Steve French Cc: Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/3] cifs: make cifs_chan_update_iface() a void function Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email haha only kidding X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787512737904899343 X-GMAIL-MSGID: 1787512737904899343 The return values for cifs_chan_update_iface() didn't match what the documentation said and nothing was checking them anyway. Just make it a void function. Signed-off-by: Dan Carpenter --- fs/smb/client/cifsproto.h | 2 +- fs/smb/client/sess.c | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h index afbab86331a1..a841bf4967fa 100644 --- a/fs/smb/client/cifsproto.h +++ b/fs/smb/client/cifsproto.h @@ -656,7 +656,7 @@ cifs_chan_is_iface_active(struct cifs_ses *ses, struct TCP_Server_Info *server); void cifs_disable_secondary_channels(struct cifs_ses *ses); -int +void cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server); int SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon, bool in_mount); diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c index 775c6a4a2f4b..f7b216dd06b2 100644 --- a/fs/smb/client/sess.c +++ b/fs/smb/client/sess.c @@ -356,10 +356,9 @@ cifs_disable_secondary_channels(struct cifs_ses *ses) /* * update the iface for the channel if necessary. - * will return 0 when iface is updated, 1 if removed, 2 otherwise * Must be called with chan_lock held. */ -int +void cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server) { unsigned int chan_index; @@ -368,20 +367,19 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server) struct cifs_server_iface *old_iface = NULL; struct cifs_server_iface *last_iface = NULL; struct sockaddr_storage ss; - int rc = 0; spin_lock(&ses->chan_lock); chan_index = cifs_ses_get_chan_index(ses, server); if (chan_index == CIFS_INVAL_CHAN_INDEX) { spin_unlock(&ses->chan_lock); - return 0; + return; } if (ses->chans[chan_index].iface) { old_iface = ses->chans[chan_index].iface; if (old_iface->is_active) { spin_unlock(&ses->chan_lock); - return 1; + return; } } spin_unlock(&ses->chan_lock); @@ -394,7 +392,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server) if (!ses->iface_count) { spin_unlock(&ses->iface_lock); cifs_dbg(VFS, "server %s does not advertise interfaces\n", ses->server->hostname); - return 0; + return; } last_iface = list_last_entry(&ses->iface_list, struct cifs_server_iface, @@ -434,7 +432,6 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server) } if (list_entry_is_head(iface, &ses->iface_list, iface_head)) { - rc = 1; iface = NULL; cifs_dbg(FYI, "unable to find a suitable iface\n"); } @@ -449,7 +446,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server) } spin_unlock(&ses->iface_lock); - return 0; + return; } /* now drop the ref to the current iface */ @@ -478,13 +475,13 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server) chan_index = cifs_ses_get_chan_index(ses, server); if (chan_index == CIFS_INVAL_CHAN_INDEX) { spin_unlock(&ses->chan_lock); - return 0; + return; } ses->chans[chan_index].iface = iface; spin_unlock(&ses->chan_lock); - return rc; + return; } /* From patchwork Mon Jan 8 09:09:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 185861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp906225dyq; Mon, 8 Jan 2024 01:10:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHQR5InPki5Eall+GcZayMVr0pERngOkzSKNhOEenF6FSn6cU5RP3cLoQYFX+CGrTCQTgg X-Received: by 2002:ac8:59d5:0:b0:429:91c3:a6dd with SMTP id f21-20020ac859d5000000b0042991c3a6ddmr2685038qtf.12.1704705058110; Mon, 08 Jan 2024 01:10:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704705058; cv=none; d=google.com; s=arc-20160816; b=xefwxWnwk0rdgqnOe9hxGFsqmnqj/AxjnJVyGMIusWqIEVJ7p79g1eEj0LEgyxGXTS LTigBdiVU6dgCL+zjvwo4K8a9CuwqqBWaqe/ypinM0kj/UdtDbB70AYiJUmDdyzWsKP3 Dj/sne20AoZ3fAB1+g2ufHm7e6VJz8PccqjFrH4CTtITh6taWoCUDusxdSmLnkGCIuzI VAzpmb1TyF8JCLBr1xpdcklkUsY3sxKfNYk/cplwnBQnmvaOiNZW77QFiQMsHmhhrDSg dJbgj4nCRdJw/Rq0WKwIACWDgbded8KiySQPE+6Ep6rgYuTkuKovnthIHWx7093BkEub PGCg== ARC-Message-Signature: i=1; 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:message-id:subject:cc:to:from :date:dkim-signature; bh=TpH6e5f9CwrQldKdZ83I+BJ56xcegVaU/llwUYD/L+Y=; fh=IdcYQNVrZnbXzC/z9Tuow4IZ1RPDuZ+T15ALMDkZV7k=; b=RQde47dVNuI51Gm/oHJFlxpDbPuB9fAFjDFcyjtVmnE0JEziAOLUUIwzZjptk+kxtK EBveaazgsGD3KuTYyv9gGacDIOk6XTHCFtBCe10hQK6fdgbPclrC4ID7XKKcQ4WQ52+W vzJuR38eOLijzFip9xBs5ssCJMmH/6xuppVrAiv7vGlq+7GDEVraf2F3h7v0/Q5gakyJ u8wG0UeJ43Sb2Ym9Y+dCEyYobmuKhe9sJsTYr6uxFcu4H/ts2xjS3YYucj9c/4JfdS0M fvERgwUDrSlEJ5PEMemI0UBwTV2AgjXZBhUxPurBSbDHolPd+uk5KbrgNg1zmN7fE0c1 gFFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AFGpGo04; spf=pass (google.com: domain of linux-kernel+bounces-19248-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19248-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o12-20020a05622a044c00b004283795acbbsi7455745qtx.527.2024.01.08.01.10.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 01:10:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19248-ouuuleilei=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=AFGpGo04; spf=pass (google.com: domain of linux-kernel+bounces-19248-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19248-ouuuleilei=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 D01961C22189 for ; Mon, 8 Jan 2024 09:10:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C04E13AE2; Mon, 8 Jan 2024 09:09:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="AFGpGo04" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.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 B6B7E11716 for ; Mon, 8 Jan 2024 09:09:32 +0000 (UTC) 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-wm1-f53.google.com with SMTP id 5b1f17b1804b1-40d5f40ce04so18494995e9.2 for ; Mon, 08 Jan 2024 01:09:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704704971; x=1705309771; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=TpH6e5f9CwrQldKdZ83I+BJ56xcegVaU/llwUYD/L+Y=; b=AFGpGo04OG/UOdW/snZ+nSH+V0RLndPg+hnfmBW/LftAEgeD8U83ltQRl/n5E+96ma /t+XAI8hB6bYwEmrjIaO58DOmJueYfsBpr1Qy2vQfQ98wPBjYv1gCep/+9KGUFEqxgty ZDitpY3n8SsYkUcN4GlzvUQVsLldYNNE14D1jgoVdP0zADqR1rb4j+/kBZasBl9v5JTJ Cx4vV+Ehux6dCDA6+hF7dJwfWyXJogtGnRlsIRwT5O9h072AnUwTE+1u9FkYLz6yo8Gc lk0d+VcdbhLE2s9hVwpJYR02vFqiF4sL6je8xkonDc1ClRJtYIt0tgDzEOha8G9qtbjX Li0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704704971; x=1705309771; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TpH6e5f9CwrQldKdZ83I+BJ56xcegVaU/llwUYD/L+Y=; b=diFDg8YDTZBxUymsvZ2icuaYrRbuNc0p0Yion37srHFEfCoxDWiyQh3tE9sehuwqpl c9EZ7W9VbjpesCEcszbgm7GVYXzCSxMm0y8ryqf+/EX9LrmZvymGDIu8UogV3QhD6rCc QVVp25nXa3c48GfDbTkRxf0hIgT1qkl1zFF8PH0Z2UrsB11xF3fSKuWBLwTbKW0BL7Py z/5n1DigOjbCxlmy5atyTZwbm/VK/CJ2ZmM5sa2Ytfgw5El4jjzagTWbnClngxrngVV+ UV0g5AX+PIjkfaL2wHcUp2OmMs6p9LfpYyJlYm/LVFN3z/+lLeHTS0wuDwhRomthA37b 6RXQ== X-Gm-Message-State: AOJu0YxpLxlrOo/i3Ry7Smi8Z+PokDnjB1jj4Ol0Ps3arK83zNuNB0Jk /TAkpnvuSdihWBtXntwUy43Zk4yKvC6n2g== X-Received: by 2002:a05:600c:1d24:b0:40d:83e1:6c62 with SMTP id l36-20020a05600c1d2400b0040d83e16c62mr1798205wms.7.1704704971098; Mon, 08 Jan 2024 01:09:31 -0800 (PST) Received: from localhost ([102.140.209.237]) by smtp.gmail.com with ESMTPSA id n43-20020a05600c502b00b0040e45799541sm3892170wmr.15.2024.01.08.01.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 01:09:30 -0800 (PST) Date: Mon, 8 Jan 2024 12:09:27 +0300 From: Dan Carpenter To: Steve French Cc: Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 3/3] cifs: simplify a check in cifs_chan_update_iface() Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email haha only kidding X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787512810888050538 X-GMAIL-MSGID: 1787512810888050538 The loop iterator in a list_for_each() loop is never NULL at the end. This condition uses a two step process of setting the iterator, "iface", from non-NULL to NULL and then checking if it's NULL. It's easier to do in one step. Signed-off-by: Dan Carpenter --- fs/smb/client/sess.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c index f7b216dd06b2..987188e1929e 100644 --- a/fs/smb/client/sess.c +++ b/fs/smb/client/sess.c @@ -363,7 +363,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server) { unsigned int chan_index; size_t iface_weight = 0, iface_min_speed = 0; - struct cifs_server_iface *iface = NULL; + struct cifs_server_iface *iface; struct cifs_server_iface *old_iface = NULL; struct cifs_server_iface *last_iface = NULL; struct sockaddr_storage ss; @@ -432,11 +432,6 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server) } if (list_entry_is_head(iface, &ses->iface_list, iface_head)) { - iface = NULL; - cifs_dbg(FYI, "unable to find a suitable iface\n"); - } - - if (!iface) { if (!chan_index) cifs_dbg(FYI, "unable to get the interface matching: %pIS\n", &ss);