From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 16F82143733; Thu, 13 Jun 2024 11:45:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718279122; cv=none; b=n7uBVSCCBJ9vwX+erqx4sU69dRbUGoR+vvHxLHCMuAAdYUMxkyI6oIgbwiBoi9+4j+f3Fx/Bfy+p5v1u6hbWo/R65A887NFywQTlYtMMcAi5823iJI/oXdLguk7RlpRHxwNVgwMvM4yvpiMwK6enrL7R9JC2DqunzAhAcvW51b4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718279122; c=relaxed/simple; bh=Il65WoHwN3bEyCGYGM/TnvELmNAhsLBg+MIg8K3xFGI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CyOP661KzRbBRkx/kZka6t7FpnLNLpSQeoDZwpRexnS2RcCIfIQ3QVYAvv2KXTtMZjNSTYyUKfJDwOvkKAkstq5uNLJGt5rkwhWY4V86gRaevqnDL8jTD1syAFbaknVe9WBaU2NtJlDOrrHs8zXhNJhN8IB9n5sN0FBtRllKZPw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WfdwQ9ud; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="WfdwQ9ud" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94021C2BBFC; Thu, 13 Jun 2024 11:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718279122; bh=Il65WoHwN3bEyCGYGM/TnvELmNAhsLBg+MIg8K3xFGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WfdwQ9udIJPp1u/mOOPGFxXKKSIpINafQmD+GccBiXkjmC8y4JSLQUMuXMfsnWuG0 Jx5TExz7cgIwfe/wSTuWIPirvObOhL3xLd2v9knkFsGFoeK+Evs/KTvjdIqqrbai9o l8hN545COTQJd3m1+VLTE14bj8p/lXKA9JVPzzJQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sergey Shtylyov , Niklas Cassel , Damien Le Moal Subject: [PATCH 4.19 151/213] ata: pata_legacy: make legacy_exit() work again Date: Thu, 13 Jun 2024 13:33:19 +0200 Message-ID: <20240613113233.812253916@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240613113227.969123070@linuxfoundation.org> References: <20240613113227.969123070@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sergey Shtylyov commit d4a89339f17c87c4990070e9116462d16e75894f upstream. Commit defc9cd826e4 ("pata_legacy: resychronize with upstream changes and resubmit") missed to update legacy_exit(), so that it now fails to do any cleanup -- the loop body there can never be entered. Fix that and finally remove now useless nr_legacy_host variable... Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool. Fixes: defc9cd826e4 ("pata_legacy: resychronize with upstream changes and resubmit") Cc: stable@vger.kernel.org Signed-off-by: Sergey Shtylyov Reviewed-by: Niklas Cassel Signed-off-by: Damien Le Moal Signed-off-by: Greg Kroah-Hartman --- drivers/ata/pata_legacy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c @@ -128,8 +128,6 @@ static int legacy_port[NR_HOST] = { 0x1f static struct legacy_probe probe_list[NR_HOST]; static struct legacy_data legacy_data[NR_HOST]; static struct ata_host *legacy_host[NR_HOST]; -static int nr_legacy_host; - static int probe_all; /* Set to check all ISA port ranges */ static int ht6560a; /* HT 6560A on primary 1, second 2, both 3 */ @@ -1253,9 +1251,11 @@ static __exit void legacy_exit(void) { int i; - for (i = 0; i < nr_legacy_host; i++) { + for (i = 0; i < NR_HOST; i++) { struct legacy_data *ld = &legacy_data[i]; - ata_host_detach(legacy_host[i]); + + if (legacy_host[i]) + ata_host_detach(legacy_host[i]); platform_device_unregister(ld->platform_dev); } }