Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp203725rwe; Fri, 26 Aug 2022 03:37:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR4tiN/MZKbIEtyK9OU1Q7eNz+I6rN/K5BeK8dgLvyfYngZyG1A7Hxk/NRsvaF/AXE4ZF8v9 X-Received: by 2002:a17:906:4d9a:b0:73d:b425:d6b8 with SMTP id s26-20020a1709064d9a00b0073db425d6b8mr5052914eju.120.1661510237422; Fri, 26 Aug 2022 03:37:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661510237; cv=none; d=google.com; s=arc-20160816; b=CGwqLV/HRcjmOqSzV484tBiTkZEylcOsxJ2cWm9nCsLtHoyrkS9FhdTLe1mqjoum6F 4bOOg2CZ+LjworUDncg+J7iJLEtgpqgc07vGllX4vNBSF0CU5CXg5PBGaNGynH5qxVZd NZthSjT/j2oZSuwYlNu4hFDX0t3q9fKkIIfycGuXcs1/ebPzR1oCjd5kVAaQzLrrNgM+ WBxmlxuCvetQ7xxmJKsORow0vOEZFtN5uRKK08zbvOsuEnmjETgiCDU2Uixe/jp6qpJF d7D7k9+491EGTuJ2Trk9Zp0b5EI3+4mlF7lc7ZXGXg26QTW4E1smSP+icmzLMqsqtPxq QhBw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=jUvL2nRoIT+XrpDJMxG8OypfnLdV/LevBya7ruKPhk8=; b=Kgjiu6Irh6+SMe6H+9dY9PVsveshaTO3k5sBvPbhAXTHMjTLdoA+ztDLH4mchg9rKO Hx2KUAyyj8E8SEnBxrCHXaLtRREt0ltfKwbjbmsEpRFd74Os3e1PnpGAjhhEyRqSxcYA HzlbyVJqwn1xVtw0e4tyT4dpGQ5mj6vpilyVxfB32Gno9d1wLSa2S1Rghud6BtRwrhER yd1x+hRlgfnQexbGJa1rZqbq1QqezJ1JQAi1mrpDJvvSQAaglUN7SFYKkjZXbnMRj9h9 tOSkRzOlfFwlYE1nLMAnsfR4ierl8NSGKlNKZ2vv9Hou+cOCkgoPmWI38jvEB8nXtB96 OHNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=UxmG8eY5; 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 b15-20020a056402084f00b004468ec0d67csi1198772edz.565.2022.08.26.03.36.49; Fri, 26 Aug 2022 03:37:17 -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=UxmG8eY5; 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 S245296AbiHZKMg (ORCPT + 99 others); Fri, 26 Aug 2022 06:12:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245368AbiHZKMb (ORCPT ); Fri, 26 Aug 2022 06:12:31 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 753C2B6035 for ; Fri, 26 Aug 2022 03:12:30 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id tl26so1513797ejc.9 for ; Fri, 26 Aug 2022 03:12:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=jUvL2nRoIT+XrpDJMxG8OypfnLdV/LevBya7ruKPhk8=; b=UxmG8eY5zkAdmjtDBAbYbXWOa2h9YrO4OtS+/4m1qPyamDZtGw7WBQnJ45mIXJrYHD kvudJM+xAJZGJnoEpgDmd9D0vWHJK+4X4sAIT0IR7zO4fUN7eIyZJOGkh9te6xvuwprF AOiz/bIFLHw9vWkd1weTOK84jX63z9qorZNx4BSZbO7bep/g/Y5TLIpn8bFMGQh2nczi 0VcIr9rdLY/rmyarUw62IiTS3OAjoRvxKIk0n0E53ey0lAkhdMDhKvK43AAHoM2GQYKq pCO9z/wjknIRbBOVqNbrWHXlgRyJCwaYLqr65zeL3jOYB0Hy/XT4qXLZnbsASgzPb3Ri R7BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=jUvL2nRoIT+XrpDJMxG8OypfnLdV/LevBya7ruKPhk8=; b=bSm9uNLKYF+d4Bdvx5JjN7wT8dVnBQ3ZO/C5cNcVaLceMpTjSa82kHABKXlXsB5DyM N9J6gN6i2Zyk7YwQS4exZEiF6ZaiR+T6zl8K+eAV2QsCda8KCVaT3Z/MNGPSyAk0LS6c Q7LqoBkXm5nnbH/Pw5jI/r34nOIN7UViNsVYiL1RAQY4/qtX6iU1nslctD8CrvpGC07w l+76hZqukcsldvVDBsI1EIXMnpGtv3xJnaQFCDrZoLZbANvBWiETUbnXtvJoLnROcmJd Q9hvY3huKryiqPqw7JsXjnZeA+r0v1wMyrZ+0+9xI958qYoylkjeb+3h4QTUYEJMIXbM Ujew== X-Gm-Message-State: ACgBeo3j+iR/Tukvm79ll2KgnDEz+55rLL5hXUDkfKYyMX2evyzchv71 0R2NmItaGLAyiyVl/GOdVCC8fg7hscu6Zw== X-Received: by 2002:a17:907:724f:b0:731:9ec:10fc with SMTP id ds15-20020a170907724f00b0073109ec10fcmr5085017ejc.427.1661508748671; Fri, 26 Aug 2022 03:12:28 -0700 (PDT) Received: from lb02065.fritz.box ([2001:9e8:140d:2300:3a17:fa67:2b0b:b905]) by smtp.gmail.com with ESMTPSA id h3-20020a056402094300b00445e037345csm1056984edz.14.2022.08.26.03.12.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Aug 2022 03:12:27 -0700 (PDT) From: Jack Wang To: sre@kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] HSI: omap_ssi_port: Fix dma_map_sg error check Date: Fri, 26 Aug 2022 12:12:27 +0200 Message-Id: <20220826101227.78237-1-jinpu.wang@ionos.com> X-Mailer: git-send-email 2.34.1 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 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 to caller. Cc: Sebastian Reichel Cc: linux-kernel@vger.kernel.org (open list) Fixes: b209e047bc74 ("HSI: Introduce OMAP SSI driver") Signed-off-by: Jack Wang --- drivers/hsi/controllers/omap_ssi_port.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hsi/controllers/omap_ssi_port.c b/drivers/hsi/controllers/omap_ssi_port.c index a0cb5be246e1..b9495b720f1b 100644 --- a/drivers/hsi/controllers/omap_ssi_port.c +++ b/drivers/hsi/controllers/omap_ssi_port.c @@ -230,10 +230,10 @@ static int ssi_start_dma(struct hsi_msg *msg, int lch) if (msg->ttype == HSI_MSG_READ) { err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents, DMA_FROM_DEVICE); - if (err < 0) { + if (!err) { dev_dbg(&ssi->device, "DMA map SG failed !\n"); pm_runtime_put_autosuspend(omap_port->pdev); - return err; + return -EIO; } csdp = SSI_DST_BURST_4x32_BIT | SSI_DST_MEMORY_PORT | SSI_SRC_SINGLE_ACCESS0 | SSI_SRC_PERIPHERAL_PORT | @@ -247,10 +247,10 @@ static int ssi_start_dma(struct hsi_msg *msg, int lch) } else { err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents, DMA_TO_DEVICE); - if (err < 0) { + if (!err) { dev_dbg(&ssi->device, "DMA map SG failed !\n"); pm_runtime_put_autosuspend(omap_port->pdev); - return err; + return -EIO; } csdp = SSI_SRC_BURST_4x32_BIT | SSI_SRC_MEMORY_PORT | SSI_DST_SINGLE_ACCESS0 | SSI_DST_PERIPHERAL_PORT | -- 2.34.1