From patchwork Mon Oct 24 11:30:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8935 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434968wru; Mon, 24 Oct 2022 05:53:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6aRcmPXDFyhJSyEYtF3Wlh1J8KiheU/qq7Zg0S6iXSfz108ZzQkIl+APgvdMfjwxtRzqJb X-Received: by 2002:a17:907:3181:b0:787:d81c:a6ad with SMTP id xe1-20020a170907318100b00787d81ca6admr27599684ejb.769.1666616002673; Mon, 24 Oct 2022 05:53:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616002; cv=none; d=google.com; s=arc-20160816; b=Hp2SXx4sGSLO+LD4gGPhp33rUpj2TV4OY+Y22nliOna1B/PFThmJzy0bqqTfDIXUvn ONqT7txlgefATzFueMXwAgwDrfPQKeGXKg0+Pm7l0TjgedhVoxpNaI3KJIaRTA2FQbNY 7JjghaKslBpHBJxTHKRBsOnVuJYn6Ub0/BvZXO+xUBx1JSXHualkTq0I5sHgdHMX3zc/ CwbHPFewYayMl39dIxaONhJZrE3mIB8x7iOuOV+lODwrY71upZRXe511PFdQfXdFnK8U 93mVmPIQ42s6NICMcpZ8WtoRru4qmF5D9W2bwdImebbOjLeV9N4CqsrTcTiyU6G6LVbB M03w== 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=e/kBGpXdwDJNyguMG6E84sWFg3Vk/5lqTx67HNtfpJNbTkCBoKHzNbUzd9IcxOXSpw Rqq2HZBFb/iWoI1YY5qXm3WOQza/eUPk+V+Kg6wqjOKXqAOOAqd1sKn3qAW2+Si8S+Dt EKH/LCgcE2P7GTmOi20AFocwAGkvswTtfqKGzfPtyWBXd2mAwXs8S5dYhcllqXSU6XLw 5BDBEO0W8GYkUpo2/Wqx8R/za2mOmNF0B8c3yur3SQkpdUVxwx34ezoYz/z7b70Hamtr MaFtl+DxMhUicpxpyiP/dLJd+X4ZyM3nQvf/847k5N5p1Vm8hlZ6J2ROAPmqyUJovJn3 ufWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yZzPnFNb; 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 u2-20020a50eac2000000b004513a465ec6si25060719edp.94.2022.10.24.05.52.59; Mon, 24 Oct 2022 05:53:22 -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=yZzPnFNb; 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 S234307AbiJXMwF (ORCPT + 99 others); Mon, 24 Oct 2022 08:52:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234821AbiJXMpt (ORCPT ); Mon, 24 Oct 2022 08:45:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0478E72B69; Mon, 24 Oct 2022 05:10:19 -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 9A791612B9; Mon, 24 Oct 2022 12:10:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B29FEC433D6; Mon, 24 Oct 2022 12:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613419; bh=K4roTK2fnCmQiAynGRZx39W2zSKfyzroDBihQQeCMlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yZzPnFNb92nf3wnacW9NdCuaCcSK3gl0K0lZJ/Wyz2ttwT2YGBGhB+ReAPpzdCXs5 2GGhVQZNs/X9btCnIfAg3ZYNXPvLQUH+humpZ3O0gOrrh5of88RX4xqRLgg939lc6a S2Rze9fAbmuD1s8sTnKveSxnVY1nBwHR+3Yh7nVc= 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.4 130/255] HSI: omap_ssi_port: Fix dma_map_sg error check Date: Mon, 24 Oct 2022 13:30:40 +0200 Message-Id: <20221024113006.898391348@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747573541631507704?= X-GMAIL-MSGID: =?utf-8?q?1747573541631507704?= 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 |