Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp116278rdb; Wed, 20 Dec 2023 07:41:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9I5R9xm9+LJcTw6DkPc1BFsLH27bMzKBKmt0rStONrR3ZB5k+sGrcB3Gp9mWsuwT2+Oiy X-Received: by 2002:a05:6830:a56:b0:6da:1dc2:a1e3 with SMTP id g22-20020a0568300a5600b006da1dc2a1e3mr15168808otu.16.1703086865354; Wed, 20 Dec 2023 07:41:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703086865; cv=none; d=google.com; s=arc-20160816; b=Ea/0FVFSJQf9djGaGhKJtvVx2z28Zo36qLmCmPSiMg/YTBOa0WJt1PNzKqhldtCjhI X2EcSYd3okE3pScOF+y2S0vIZtCmklzoAmHn9YiwcRwyXNlYFi9F1nVghktiiO1XoKDA lfLaBzZxUEXjkLIBGGGzYKVaPYXpL7keX3r74jtSmawDnzwUlaPNNrfUiUU6E2Cg2hu5 Krqf0DjwO2noLM90OPnLiYwInbu4bcB3YHe3kaPLUqs6ovOtz9kxVF36gj1cEgJLTuPj pK31GBtPWmNS0/B54Ca2KX7l0oTJcgQ8hdTqX/SPSoH8moUHp3AAeb46K/zFiUF2HYNX OlUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization: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=UBWzAdACH/hFL/HCNmYAWJS+eOjiUKeqeA+7mYmxOVQ=; fh=jlxm1AAbbzNuiJ3COR7aakbE4oV9X6HmHbmd4Cx1+tQ=; b=cKR41Z4noklfxqFNAilYBc6u9v6ghT5rLmqNuQHcE1M5TEIhL8coMl20CkPNgAwlNd Su5phMjR2HgdIZlUcAY3Fjz9dODBfVjQ3RjKbxech8Rac3L2PWfGvR/7Z0jJUsc6vet/ B050gQBybQWfXyMVyJNmXYqe8QSPAE9/jfREpMLwweIhlGszbBjs8ZAnDHheOLtHZdRL ReVoawLTtfWWhC5ypDFlF/5pHEpgpRuEwjdf8WX3HZesQOtkXyvLytZqQC9/icI8Wgyh m5YKwyXrt27Jt7Ct2dAzya9aTGEzqK8ZFqAjnEM4Medx8BgckJ2q59R/C2BH/+wIElWz ZhLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Te+UTjxE; spf=pass (google.com: domain of linux-kernel+bounces-7181-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7181-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id fw6-20020a05622a4a8600b00423839bde26si30433906qtb.671.2023.12.20.07.41.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 07:41:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7181-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=@intel.com header.s=Intel header.b=Te+UTjxE; spf=pass (google.com: domain of linux-kernel+bounces-7181-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7181-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 1AFA11C212D0 for ; Wed, 20 Dec 2023 15:41:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC86A405DA; Wed, 20 Dec 2023 15:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Te+UTjxE" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) (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 950CD41212; Wed, 20 Dec 2023 15:40:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703086850; x=1734622850; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Z45D4Vtu6D/KyysKwwEbSvOt+bIakQUcLyQ51yCetko=; b=Te+UTjxEG2SL288QIdY+yFQ9BYjA/J95uXg5NSoCXFz32iauF7WEQcu3 xyzsiwXWaBD0c9CgwZO6SV1vTx7zlfptPSwJa96uBNFC/X8dzojBf3W0y umvOiwSZvc4mzutLuxgQxDJNhYiWmMJVd0NjoUY6VT9YL88/PHiWZvcpW IQqqVi7SsOaU8Wf8FkTUAvmlW0D6Wuui2lxZ4dJHADfIzQPIS07SplqPS a0em+Naj8qOLB2xmTD/umA/NCgEhK3p98dyzHELQbX7zUlqIB+jmjE9A3 XuG/drOA0JWjdy6s3IqN60gpjiyrMaxZAxPqE0qAe5fe28vGdWBxdMp60 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="460173996" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="460173996" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 07:40:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="769623530" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="769623530" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga007.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 07:40:46 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rFygd-00000007ad6-02kC; Wed, 20 Dec 2023 17:40:43 +0200 Date: Wed, 20 Dec 2023 17:40:42 +0200 From: Andy Shevchenko To: Hugo Villeneuve Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve , stable@vger.kernel.org, Yury Norov Subject: Re: [PATCH 02/18] serial: sc16is7xx: fix invalid sc16is7xx_lines bitfield in case of probe error Message-ID: References: <20231219171903.3530985-1-hugo@hugovil.com> <20231219171903.3530985-3-hugo@hugovil.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: <20231219171903.3530985-3-hugo@hugovil.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Tue, Dec 19, 2023 at 12:18:46PM -0500, Hugo Villeneuve wrote: > From: Hugo Villeneuve > > If an error occurs during probing, the sc16is7xx_lines bitfield may be left > in a state that doesn't represent the correct state of lines allocation. > > For example, in a system with two SC16 devices, if an error occurs only > during probing of channel (port) B of the second device, sc16is7xx_lines > final state will be 00001011b instead of the expected 00000011b. > > This is caused in part because of the "i--" in the for/loop located in > the out_ports: error path. > > Fix this by checking the return value of uart_add_one_port() and set line > allocation bit only if this was successful. This allows the refactor of > the obfuscated for(i--...) loop in the error path, and properly call > uart_remove_one_port() only when needed, and properly unset line allocation > bits. > > Also use same mechanism in remove() when calling uart_remove_one_port(). Yes, this seems to be the correct one to fix the problem described in the patch 1. I dunno why the patch 1 even exists. As for Yury's patch, you are doing fixes, so your stuff has priority on his. -- With Best Regards, Andy Shevchenko