Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4592371pxj; Wed, 12 May 2021 08:51:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmsTrlsDdC/IAz7Sb8t2dFzBOJNIFkTtaQmiSgzgzz2JKXxFBGqOabqU13rTVNVhK8XC99 X-Received: by 2002:a2e:a30c:: with SMTP id l12mr29533971lje.501.1620834691761; Wed, 12 May 2021 08:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834691; cv=none; d=google.com; s=arc-20160816; b=jrTOIQdD9wuBfTkC4UAezyJS4QiXbO24l8LiJXi6PcqigmWgxhZvV1D+KLlF7RNuG6 h8QRWCqWgLhIJuqUePd/TVYuPXjVU2smI58sVt5HgeM41LpVprIZW5kpoJRRHuohDaio 3bktqoo+B3wLeBrtO4IiIBzmGmOcKjVQIm4vY0gTXf2uYr8X6bjhojMn+msuZSSGH0+A 4CCrHI8KfCKui1sEUSIay3kBJxh2GO8d741C6YNzqLhJMB+/Obxl5pWVEWBJie6DOgiY jBMaJdhG44ZTbV4CdD06Mgoz2My6IHIjresa+KbadLy32Krxm2aSoj/9nrF9UYDNPD85 cH/g== 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=BdaFTQJmybhq5C1eFtN7W+Ndzi2pzwOWvYW5NHrZY00=; b=zWrALEFJySS4E1fAFl7NSxdYBuvAEOzCqzkpeXm5AyoeOf8QDX6+xBLOa+ysQ4SBoc qdrpf5pI2+xuKR6e/D9lGSP18eZ1hzjWcw+A2cT9ieFkBxUA8UqOyguBDphirXz9BAVa R+yNkpYg0IOnDkJo4FdwBwSSC6mZ1T3/gY8yCneod607UR0q9PIKcjWReeASAyGxSFGS vCDTdPaj0bxQkKCRcVrSqj7vNIBV2XtIRUKCEPYN8xCmsrHawDw0La6018z08a7zVvbJ T65JEPZch07rSL5UjvZdr0Iu7Ovvz3pVfWc9e55eg4BwC6nIkNjcen+hmOdGYm2OEGAC S+Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fgUEc6ID; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 188si306876lfc.309.2021.05.12.08.51.01; Wed, 12 May 2021 08:51:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fgUEc6ID; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S236844AbhELPqx (ORCPT + 99 others); Wed, 12 May 2021 11:46:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:55148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233873AbhELPVI (ORCPT ); Wed, 12 May 2021 11:21:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5F339611AD; Wed, 12 May 2021 15:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832126; bh=6hNkKI2pvt0uak00GyXphpKBhmOwCq3Ef2687Ixh6ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fgUEc6IDJUiBHMxShtDP6is2fgmMvx7EBU19ykO0reqgZc7MexuLVxcSVuBIXQ4kb 6/A63s3SMX5xnJ317AsA2A6gO6/QfpZlz3xNf0XCR4SXKAo593PhBl0BxJ7cJWGzEh 9Ef2lG0+hxCDKMv15yRbQugmrpbXTj38d3f2Gsa4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, TOTE Robot , Jia-Ju Bai , Miquel Raynal , Sasha Levin Subject: [PATCH 5.10 153/530] mtd: maps: fix error return code of physmap_flash_remove() Date: Wed, 12 May 2021 16:44:23 +0200 Message-Id: <20210512144824.873461935@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jia-Ju Bai [ Upstream commit 620b90d30c08684dc6ebee07c72755d997f9d1f6 ] When platform_get_drvdata() returns NULL to info, no error return code of physmap_flash_remove() is assigned. To fix this bug, err is assigned with -EINVAL in this case Fixes: 73566edf9b91 ("[MTD] Convert physmap to platform driver") Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20210308034446.3052-1-baijiaju1990@gmail.com Signed-off-by: Sasha Levin --- drivers/mtd/maps/physmap-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c index 001ed5deb622..4f63b8430c71 100644 --- a/drivers/mtd/maps/physmap-core.c +++ b/drivers/mtd/maps/physmap-core.c @@ -69,8 +69,10 @@ static int physmap_flash_remove(struct platform_device *dev) int i, err = 0; info = platform_get_drvdata(dev); - if (!info) + if (!info) { + err = -EINVAL; goto out; + } if (info->cmtd) { err = mtd_device_unregister(info->cmtd); -- 2.30.2