From patchwork Sat Oct 22 07:24:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7443 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098368wrr; Sat, 22 Oct 2022 01:10:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4CbSSpBkUbjL7PJPgIyOLH0SAF34yVc0ymUJ2k8qg6GbulgLRzeAqgoKvPljfbgz6jdiDh X-Received: by 2002:a65:4b85:0:b0:46e:c3bd:e499 with SMTP id t5-20020a654b85000000b0046ec3bde499mr4733710pgq.21.1666426235257; Sat, 22 Oct 2022 01:10:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426235; cv=none; d=google.com; s=arc-20160816; b=PpTfxxGqpZbyPAvh+IZSD/XGvhGUIIAic9KurNvAChmIFW7srLbs5EcQUdNm624SyI KvLBDJd6Hy+CNS7dUJwrCjsY7JIVX3yYQTQJKjV7U/BCfkEwRG5Y9zwVqJiUdfnbPIEw JYZDGWdbcc42y4CmyODBx/z0m1SgEZGWusxKsXBz9hA8+5zl5hMVqLiEASh1D58ml1R1 8eLVlrMd0V7yMGsRbuM4hwXDj7bTnaMrzrfLxPkaXd/F6wzY26oo8S0VhVyyrEnJVkTu mjHfJcNxpFOA5WOgUmV/9ZQxkAflETzYG0bvfyhA4jqqtr2RLM+wL6IOA80oy2hpbjjl iyTg== 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=lVIRB4zSXTqsZ4333e2G/+ZzELZX6fWdMt5VVrtzZnc=; b=tXe+8wgmGZIFDC5mQkLaFShFkjwQrWZQt2QfRHpnIFb+4gohhsA6tnTk4UYk0tEfo0 P0mU1Kq5xCWn/GSjBRPcCds3moXDmp0S67BTdMCuHVb2sXWhL4C8oGHWO7jFPjD13NOa taMAc5B1e9N2dfOJEMC0H5A95bs99u6QOm+z+EXBTnm+nxZhDEy83WD7gZ/Wl/EasUvy +Ars8KZq9l88pO2mzAhHlDQGnALpmpV//PZw04VoypyDTH/lBXKhcAIkKzgPHVtvWmd6 62n575DEnm5JuCer2D4QXLZlLNY/a1pdB+pkVRJDZBOZPmO+zFCcibBUh8pxaYXtwZg+ iGnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="lHxp/0+s"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020a17090a86c200b0020c4fd9306bsi1961989pjv.166.2022.10.22.01.10.21; Sat, 22 Oct 2022 01:10:35 -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="lHxp/0+s"; 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 S233271AbiJVIJ2 (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232424AbiJVIFN (ORCPT ); Sat, 22 Oct 2022 04:05:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8B1E5A3DC; Sat, 22 Oct 2022 00:52:39 -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 7020860B89; Sat, 22 Oct 2022 07:52:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86490C433B5; Sat, 22 Oct 2022 07:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425157; bh=K4roTK2fnCmQiAynGRZx39W2zSKfyzroDBihQQeCMlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lHxp/0+sOp+5y7Ldg2+BjBaJJpCI5E8n2tZjJhPDuEppzXL3BFbhmJs7F7QtKfA+V MpsDsbTaR0Nwajku0HFdBW6ukpx9tRN5SX1+yOAQK4lnIlZpTBpWiXjrn/Rh0otpDq SQE+sO9Hidg1ZzFrQEzQHGoqKbV0uijB0PaAc6EQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Reichel , Jack Wang , Sebastian Reichel , Sasha Levin Subject: [PATCH 5.19 392/717] HSI: omap_ssi_port: Fix dma_map_sg error check Date: Sat, 22 Oct 2022 09:24:31 +0200 Message-Id: <20221022072514.987704762@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747374555712898528?= X-GMAIL-MSGID: =?utf-8?q?1747374555712898528?= From: Jack Wang [ Upstream commit 551e325bbd3fb8b5a686ac1e6cf76e5641461cf2 ] 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 Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- 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 |