Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1510297rdb; Mon, 8 Jan 2024 01:08:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLB7TUaWX6wS7j1JAFPB8WEICgUL5v95oT1Cr7PWO9tCcDhV9syW2qP7+Gq4QZyAhuSaJD X-Received: by 2002:a50:871b:0:b0:557:1268:39fb with SMTP id i27-20020a50871b000000b00557126839fbmr1961883edb.4.1704704924744; Mon, 08 Jan 2024 01:08:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704704924; cv=none; d=google.com; s=arc-20160816; b=CntWO0/3WO28V8LivKwuNgOf4B+MRw5GUk1mZALW+ZD8RTgBgOFrIaKh7EGs1mTXnp b9AckKcgPBO6J1fLqSUvyysMpNnZbMguxiDJKHAeZ4MWvGffoj9uejzHnaCR8NcMQQ3a YeIJuWR5PZZe4At+JehgwvFTXk65kxunH28LewiYUsxbJai0IHir+b5Aus3SvIyUKELx t+wQDydSPgsX1MsrGYoNPy95+UbCVXz+LkbXnvLk9jYmi/5GFYkIr8PjUQZto4wHVF9E BF2HXfnTaXy7Syv1ZVLxRhDr6fvgCV+jCGNmHDoSADrEBYiJmDrwRSj8fNeDaw2pKXYU eX3A== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19244-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i12-20020a05640242cc00b0054cd723d668si3000503edc.655.2024.01.08.01.08.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 01:08:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19244-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=@linaro.org header.s=google header.b="GmV1m/Wb"; spf=pass (google.com: domain of linux-kernel+bounces-19244-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19244-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 7D8CF1F212F3 for ; Mon, 8 Jan 2024 09:08:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF7D11170D; Mon, 8 Jan 2024 09:08:06 +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-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding 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; } -- 2.42.0