Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3087283rwb; Mon, 15 Aug 2022 17:49:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR7N4Tlw24k8rUi7BppXmxo0PUvsteAB/s5VOJIolLN5+2UxzoE/MyiyrtYAlthhkKlKk0cX X-Received: by 2002:a17:907:7b9e:b0:730:cd75:dbee with SMTP id ne30-20020a1709077b9e00b00730cd75dbeemr11744860ejc.137.1660610952473; Mon, 15 Aug 2022 17:49:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610952; cv=none; d=google.com; s=arc-20160816; b=RP5vr65yeF3103q1iXy0moI5umaF+tUgsE8CxoudLiSxRbCP2/SkNwNpIxgpU/IYRu ZFWXcWZ8hHt78gTqr3Fuk1Y4E04sQB5maVWSa/U4QWacDbMWJkZ2y+CTF69DakisNQWq 6mADTncO03VekFYgYDBCswNBsUrvzUZUcZEih+YqD+smIKNDxgXOl8/LMZgD4UJg9aXK vEYDXTAPhNKDvyfb6MvPDyvItAkNW0RJEHhVntG+xGg9WynpmxDWZzX+mqnJEmd0oAo6 gWJyKJwUIlmayWDacggTz2pFYiISRVG1YRJarP6AYNYfu7CTZ+Yb3hIrOnPHRzPJubpF 3dRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u+8VcKrxlMrchCtpJ/gf6Ak33NzzrHmkpcbfXj5Jvu4=; b=YOqE3+jIJY+4CwjYR/+LHztHRcNL5z/cTM4SIj5ynrZicv8eEj/rfkQEfXIoLdkbsN vruf0+nVWJxRNkrzg2Wxu0ZaSi1rO7r/4Q+tAMWcT5UIwEFRhxvskpIY1lHMkw9so6HL 0zISTFi5933WoMN8AoG+NhzsHlz3cFKB4HW4uT3Cc03plDoOMzNEIfl3p/Cuidyhec/B MFBVuIopLEhmE5IhoJ7mUk7sEHkDEB+1PZ6XM1ENPtc0ZsTJf8G8zOH/wKYfqu9wqOml GZTUBzMJx7HY3w3lWALOeyG6yHRWVbG3suiz5yWXmhUuijCqx1AUrzHDeYVCZZcUOuIb L7WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lbBWeacq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rn8-20020a170906d92800b007316d39c2cbsi8069629ejb.516.2022.08.15.17.48.47; Mon, 15 Aug 2022 17:49:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lbBWeacq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351019AbiHPAOY (ORCPT + 99 others); Mon, 15 Aug 2022 20:14:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355290AbiHPAAm (ORCPT ); Mon, 15 Aug 2022 20:00:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28DC6491C4; Mon, 15 Aug 2022 13:21:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BA8ED61058; Mon, 15 Aug 2022 20:21:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB0C4C433D6; Mon, 15 Aug 2022 20:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594918; bh=mXRncFbX1rhnBroBNy3dqVvrGlP+7CSJazY55cdca20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lbBWeacqHW5XKxKzKa0Sj/b6Zh0FjfVZ+WmyXUgCUQIX0wpAFYs6SbTTMhaKiwH0j eXg5RUbNZF+fL3Prxu986TPDBnhrBp4eX5jl3aWXswpjPtnrjCFRHyv86WOEWAwhNU Rum++MaCZM7UULyLzYJVgoWCC4IXEeHm9yGIwZK4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Miquel Raynal , Sasha Levin Subject: [PATCH 5.19 0600/1157] mtd: spear_smi: Dont skip cleanup after mtd_device_unregister() failed Date: Mon, 15 Aug 2022 19:59:16 +0200 Message-Id: <20220815180503.666525013@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-König [ Upstream commit 0057568b391488a5940635cbda562ea397bf4bdd ] If mtd_device_unregister() fails (which it doesn't when used correctly), the resources bound by the nand chip should be freed anyhow as returning an error value doesn't prevent the device getting unbound. Instead use WARN_ON on the return value similar to how other drivers do it. This is a preparation for making platform remove callbacks return void. Signed-off-by: Uwe Kleine-König Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220603210758.148493-7-u.kleine-koenig@pengutronix.de Signed-off-by: Sasha Levin --- drivers/mtd/devices/spear_smi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c index 24073518587f..f6febe6662db 100644 --- a/drivers/mtd/devices/spear_smi.c +++ b/drivers/mtd/devices/spear_smi.c @@ -1045,7 +1045,7 @@ static int spear_smi_remove(struct platform_device *pdev) { struct spear_smi *dev; struct spear_snor_flash *flash; - int ret, i; + int i; dev = platform_get_drvdata(pdev); if (!dev) { @@ -1060,9 +1060,7 @@ static int spear_smi_remove(struct platform_device *pdev) continue; /* clean up mtd stuff */ - ret = mtd_device_unregister(&flash->mtd); - if (ret) - dev_err(&pdev->dev, "error removing mtd\n"); + WARN_ON(mtd_device_unregister(&flash->mtd)); } clk_disable_unprepare(dev->clk); -- 2.35.1