From patchwork Mon Oct 24 11:30:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8794 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430841wru; Mon, 24 Oct 2022 05:42:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cebCX/HlvlPYIBLyWuY/0p1HymSu+7tVXQVw/Kb6hhHZj48olYxVYdbRJ3ny0rCsyBQt6 X-Received: by 2002:a05:6402:b99:b0:461:afc3:9a02 with SMTP id cf25-20020a0564020b9900b00461afc39a02mr6610727edb.175.1666615341920; Mon, 24 Oct 2022 05:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615341; cv=none; d=google.com; s=arc-20160816; b=fp2UJ5YxwwLMD4HXPjPpwjoTeGdj/cAMV997/lbe1LBQY3/6XNg8Kc3HSMwrXVfGd0 SgCwVI4MH7WwBNR2aWUn+dQXcMwrg4zvD6Y0WqTG1T7O1rbAr5Iv+WwoI5UsGKgrG3CW uZpPOHgDGXa7sothyyE51BPPd1h44BIueh9jne66GCfReQV/YaXJW4D8fMO+Qi4W8dUm UScIAj4raFGp0wBBp4LJnK6TxcYFCTNORGKOfexG4WPBjGzvdNScYo+mi2eroVPJ4Hnc yv6j3tDw3vkmmGl9FoE/TkYTuQRvJGVgkHhv8yEq0QBrigmuXoJ45qCvPGX9qvwKjJJm SuNQ== 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=Ff1oMQ7KcOOLNThuh2l38zYh6wPTXaQMaqYEYxdDKoI=; b=dQE1Ckt3flNsmAzNq2PQE8nSJ4jlrXTZEjo+4ohfLF4biOycCDNj1kFVHjFEqlIcar z8TMjmDxLJrWZTBEzwgoutkz1Zt4nsYUGawjbj18XWWvU3srePh66m0JeMern9BmD+aU IxPwVdVuosk8jCZ0SH2m5/X0j36y3e/61oz6YQMFcw4NN9/hrEbt2cmD/a4gWyMl7hwv 643ZgFZqq71ILXf+egCLH56dVEELHWvOJ7NAb04I745Rj9FCp3EmuXHKGDQYB+MWFzSs DrI4ZmRRjhS0/HSsMjRylbuffGYp8KpGZAkT0YFXaFdm3DI6lX2g2po+98RAAXrEVh+C yo0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DiSsIok9; 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 m24-20020a50ef18000000b004615b657cbcsi7448731eds.190.2022.10.24.05.41.55; Mon, 24 Oct 2022 05:42: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=@linuxfoundation.org header.s=korg header.b=DiSsIok9; 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 S234043AbiJXMc5 (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234003AbiJXM3K (ORCPT ); Mon, 24 Oct 2022 08:29:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BDA5876A0; Mon, 24 Oct 2022 05:03:01 -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 ams.source.kernel.org (Postfix) with ESMTPS id C1F2DB811F8; Mon, 24 Oct 2022 12:00:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 203EFC433C1; Mon, 24 Oct 2022 12:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612806; bh=GehjbJHBXOzgVNA6DOTPtzJcRKMuOSCjvnVq1+rQcqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DiSsIok9fjKn1EeXgu9sn5L/Nv3dZlfIIk/nEwr2CGB1d10s/Zv24qm5Cnqd25JAq YbD/jy6RzTySqFlWroEmzIK8lgjFRXZCGeYrxsHw/6UZD1z1hDjhlmAxg0+gIWIa25 vDkxawgExfxUndKFz1Ix1lVudxWrsVthd6XTl6ic= 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 4.19 127/229] HSI: omap_ssi_port: Fix dma_map_sg error check Date: Mon, 24 Oct 2022 13:30:46 +0200 Message-Id: <20221024113003.109588084@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747572848864801213?= X-GMAIL-MSGID: =?utf-8?q?1747572848864801213?= 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 2ada82d2ec8c..e6149fd43b62 100644 --- a/drivers/hsi/controllers/omap_ssi_port.c +++ b/drivers/hsi/controllers/omap_ssi_port.c @@ -253,10 +253,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 | @@ -270,10 +270,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 |