From patchwork Mon Oct 24 11:30:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422404wru; Mon, 24 Oct 2022 05:22:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kqTj7x7k7vTLfkbqqZDwPl632LZHDJU5ZNIXqvWGhl4F1mhkE9Q3QDDKD2REd0C4kXZul X-Received: by 2002:aa7:df08:0:b0:461:d9a2:b247 with SMTP id c8-20020aa7df08000000b00461d9a2b247mr2892874edy.54.1666614156683; Mon, 24 Oct 2022 05:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614156; cv=none; d=google.com; s=arc-20160816; b=EeZPTpPXkmiz3WGCxVaZHOHfI2MBnodvyQemqHzcnq6k1pbYO8+3yWbE8n6NCuR0f/ JQQNTJGeUB8odDJZX0snpwRoKEvA/CMXi0HxzAp/9cIUkcl7Y1TLg33DJmn+A+ya7CRp 0A+Ltmsb92cyWUXeM0VXV/ySjCyi1xyApfq6JxW/Br2HUL2v9V2sBfu8IrLgoA9rWrq7 O1cZNrPrhlEKXiZO7W+5wlCnvNk+hJpv9hn4p2o+whgish8IPSBPze5LqenZaBCrkbgx tWXryyH4Ag6IjgHFc8HhVWsMkt8C0Y8PuBZKUpMr1LSIQ5eaY8hUxDR0eMpjP7Ftd0LP OLMw== 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=+jC96M70CTc/mgLZwNq9AYuEB+LMif/W5msEdG8YzjU=; b=xRLHwlz9UZH4mSi0hkZFUzcFKzsf3TSdOedMG3qmfAMNNaR8CLXMu+exCfpibvKjPL +wZQ7f6hfOJnmphevzx5rxNm0OLMNBE91axTPuAgdv7iV8O4fMrlt/uxdaVjv8OVofQq T9hYxlbZ+gLahXvkn4IHhTsjjDIFa3Tsf50ust4TycpabQ0yCAu2jr6rMbJ+9ET3TAOy DLpKdTD1gXFpFqYWKylkANJ9Y+AD2jBqMsKLYZKi6VeToOPW2nyeXGlGl7SSpfSo4QJT Bc4gQ6QNbdT1H9ZqBAncq/irCGoW5rYrU3yAiBirjsDdeqdcbaCL4T9WcGjLb9kyQe5K xNpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xGpHThms; 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 j26-20020a170906255a00b0078de8494d15si7130213ejb.996.2022.10.24.05.22.12; Mon, 24 Oct 2022 05:22:36 -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=xGpHThms; 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 S233331AbiJXMUw (ORCPT + 99 others); Mon, 24 Oct 2022 08:20:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233369AbiJXMTS (ORCPT ); Mon, 24 Oct 2022 08:19:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF8C582D04; Mon, 24 Oct 2022 04:58:03 -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 23331612CC; Mon, 24 Oct 2022 11:50:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36EB9C433D6; Mon, 24 Oct 2022 11:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612239; bh=Jhmkst0PnxOYr9CFYZdLcK8CmYezRA+qQmUrSlsWzgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xGpHThms2odKul/Tg6KR5Vbc4qwaqh11Nx0ZOq+/sH8fr2A+cvdFYzsQ+SDiGVI4e 5zRBVHipgtl5VhAsQ9GKo1ZSQHIdfvqwjeGbff0xPDWLpX2QgQwMXJcBm9IR4+yK04 jm5O0WkoPQctgQJtxedwQjLBhSWLBCFI2i1cZQEc= 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.14 122/210] HSI: omap_ssi_port: Fix dma_map_sg error check Date: Mon, 24 Oct 2022 13:30:39 +0200 Message-Id: <20221024113000.936773739@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@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?1747571605654746742?= X-GMAIL-MSGID: =?utf-8?q?1747571605654746742?= 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 7765de2f1ef1..68619dd6dfc1 100644 --- a/drivers/hsi/controllers/omap_ssi_port.c +++ b/drivers/hsi/controllers/omap_ssi_port.c @@ -252,10 +252,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 | @@ -269,10 +269,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 |