Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp351248rwe; Thu, 25 Aug 2022 01:11:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR7dhjqG7SOMMSChd9wInXpz3llDZxWFilBk6w2HbhsaDTdx3PuZuMQV7lLK0BlEtLLSV5VP X-Received: by 2002:a17:907:2bdb:b0:73d:d7af:c133 with SMTP id gv27-20020a1709072bdb00b0073dd7afc133mr400522ejc.545.1661415081284; Thu, 25 Aug 2022 01:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661415081; cv=none; d=google.com; s=arc-20160816; b=Ka0fQaQW6j91IqzOtbsIx86uLw5+NqsuTR2nD9GvJ5C5vWCTR5wAxrkjSAKl4O5XXQ cxqFHXsnCG25QP66LkL9y2KvWTe+DW4T5Ff3Wa+aQiqazLy9JXFHN7Vm4x7XcDvrzaNW RKRIni54MfvcjBaBI7HiEbmIC1fYcFVykZgB2FnB+4+ZXMI6QVtO8pM0X99njUzP3g4M R7xl8DlMeXffjx/sn/EcfDTrg7HNqSqmyWhw5/YonYRi6H4gGGY36HaLrNXm6eGytETJ Bre3P5ZgDR/pW1Oo0KfgSL9wCgPehnqVWo3dwJt7/NPlmX9Kw0Ib/fntcoyAqf1zi/iL 1LeQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=78LV1OFXn4kU+Li1Jo3v1pAvNQIAGmy0sk/6bF76fRQ=; b=1Ex3MxhouK0ZPpuqViVEYooLdtdpkDm4S6483eoSB0064UcrOycEFiRvcSDPB6BWNx z6jDvrg07unXljz+QxUfLAO02ajrp52fbz2MYydM/fJOZLNMsFgtmY/7OFZymuYVytxW aqqreJCEkwEM/zdtgwXbNns4EmgJy0HPsy51p6rgCQYautGs2ec3DoFAlplkpvoe3DTl +3x1Y5MmZw7Ai1zhrm6nGeD7ITIOLn+w9tGUHwt+41JY/zPkB8AdPI92vv0RNJAAWGUU hnfXDBfFKsuULXsd0LqcVb1QT6wRPfdD+NL70ymt1O4it01aCb5Lxh06JeZvgNRQx00s EJfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=Wd51wZvW; 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=ionos.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b93-20020a509f66000000b0044628054fedsi5350544edf.435.2022.08.25.01.10.55; Thu, 25 Aug 2022 01:11:21 -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=@ionos.com header.s=google header.b=Wd51wZvW; 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=ionos.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238527AbiHYHxt (ORCPT + 99 others); Thu, 25 Aug 2022 03:53:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233350AbiHYHxn (ORCPT ); Thu, 25 Aug 2022 03:53:43 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 819F8A2D91 for ; Thu, 25 Aug 2022 00:53:42 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id w20so9259611edd.10 for ; Thu, 25 Aug 2022 00:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=78LV1OFXn4kU+Li1Jo3v1pAvNQIAGmy0sk/6bF76fRQ=; b=Wd51wZvW5WFwaIoYN+lZ7WHoYz8LAT/LPsPSjAobWsPxeAy1SqWwSgQXNTbCFJEEFN dTuv8fiTkttDgJ+zDqXUQeTmFin9tS1kg3LomvI5oh0xcddf71DyXfveF39TixR4DFxu hRv+fJxhv+j9rRQqeUIqwJdFXp/gz2MKdQZ34HsnWsPDKV8Q8eHBxuC1P1GC5+3VcuO1 V8j+cHHxip61cL0sUUkKKMjZn25Dy9eHrHWW2KQR3wVa/Gy0MXSsERnN8iNyTpYkxiTI 7pzltRRgFUBUU2HudbKJ/l9Iz4WZwQhzAGhVZS8aqWN/dybO0mS+upWrof4DYmhTSpK8 BxMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=78LV1OFXn4kU+Li1Jo3v1pAvNQIAGmy0sk/6bF76fRQ=; b=GQc4IM/idYifBGlC6WNROgiwz9LC18R1B2yoqd9XwJPI5/KyzlwGCsNJ02KS1lXGNd +U8LPcYFQBSQOjtjKrOv7sVWmtvAqWsiB/0F1IxX8G0hEp4IWVItjDUEWs5B1cQvQTxM GL0bNDGoPNOc7oHpK/RVeC5YhdELgM1Q4X8Pn8mBrjtCgCK373XEtWypOEDYjsVbYkm1 qrewte4Y0Fk4QEhUKgttokPGX84GKIul+OXWLLqVsPb1COhiY0rTOo0FX5lsGDZJshEH exPxG6iDXteVm4oaH/WTMUGa6pRvoUU3iTLKoWCojvOg16MBU4zyS2f3K2KEkgoekT5M FDWA== X-Gm-Message-State: ACgBeo1twZygA5DTI5dZ71v46O3jfHlJe2IrDqIsuFCxY+LcxtYhe+Ja o4cJgMqGYyE2ufS0C8E/OscI8g== X-Received: by 2002:a05:6402:3509:b0:43e:d80b:44a8 with SMTP id b9-20020a056402350900b0043ed80b44a8mr2174857edd.255.1661414021084; Thu, 25 Aug 2022 00:53:41 -0700 (PDT) Received: from lb02065.fritz.box ([2001:9e8:142d:a900:eab:b5b1:a064:1d0d]) by smtp.gmail.com with ESMTPSA id x22-20020a170906b09600b0073dbfd33a8dsm1491736ejy.21.2022.08.25.00.53.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 00:53:40 -0700 (PDT) From: Jack Wang To: miquel.raynal@bootlin.com, linux-mtd@lists.infradead.org Cc: Richard Weinberger , Vignesh Raghavendra , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Christophe Kerello , Cai Huoqing , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] mtd: rawnand: stm32_fmc2: Fix dma_map_sg error check Date: Thu, 25 Aug 2022 09:53:37 +0200 Message-Id: <20220825075338.35338-2-jinpu.wang@ionos.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220825075338.35338-1-jinpu.wang@ionos.com> References: <20220825075338.35338-1-jinpu.wang@ionos.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 dma_map_sg return 0 on error, in case of error return -EIO. Cc: Miquel Raynal Cc: Richard Weinberger Cc: Vignesh Raghavendra Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: Philipp Zabel Cc: Christophe Kerello Cc: Cai Huoqing Cc: linux-mtd@lists.infradead.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Fixes: 2cd457f328c1 ("mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver") Signed-off-by: Jack Wang --- drivers/mtd/nand/raw/stm32_fmc2_nand.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c index 87c1c7dd97eb..a0c825af19fa 100644 --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c @@ -862,8 +862,8 @@ static int stm32_fmc2_nfc_xfer(struct nand_chip *chip, const u8 *buf, ret = dma_map_sg(nfc->dev, nfc->dma_data_sg.sgl, eccsteps, dma_data_dir); - if (ret < 0) - return ret; + if (!ret) + return -EIO; desc_data = dmaengine_prep_slave_sg(dma_ch, nfc->dma_data_sg.sgl, eccsteps, dma_transfer_dir, @@ -893,8 +893,10 @@ static int stm32_fmc2_nfc_xfer(struct nand_chip *chip, const u8 *buf, ret = dma_map_sg(nfc->dev, nfc->dma_ecc_sg.sgl, eccsteps, dma_data_dir); - if (ret < 0) + if (!ret) { + ret = -EIO; goto err_unmap_data; + } desc_ecc = dmaengine_prep_slave_sg(nfc->dma_ecc_ch, nfc->dma_ecc_sg.sgl, -- 2.34.1