Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7044923rwi; Mon, 24 Oct 2022 09:09:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Y9KxV/2uUso9XDFgqHl7Y3spR3swey7GcGqt1jGiicbzjybgy2SUOWpD/NXD75i/He4S9 X-Received: by 2002:a05:6402:46:b0:45c:bd68:6ab0 with SMTP id f6-20020a056402004600b0045cbd686ab0mr31725900edu.16.1666627765747; Mon, 24 Oct 2022 09:09:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627765; cv=none; d=google.com; s=arc-20160816; b=g86qRgnGf1ePNvHgSIHXVt+EDlbpEmMHOpSeScrfe4XKryMzoXWA0egvddTVQQVSJG k0WAlEZVGe1bTCh1GbNVK/8X7jdbusd7/yotomW9vNDOHCsYXSEXalk6Q38VfkxIRhsU lCT7Sia1rWZOOhqT+0CHlcf87pIIPN78C2xJ95p/g+ErvvWbCeddc1FPRmxi9Cx3e9kp eSgmtUVa+6iJFxLHC/Dw5651S5vOO0Br+1dyle0fIbseg3/ILbNVoo/k1CyVdt0ykBbD 2LKlQlHO/2d5ZgBX0/KrUhmBvJlBAxG188bOqJiJ7bgaPh0TDjRjX08rBdif5cygHoxs NCyA== 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=i0/7tJwNsaLhvdh/JUDaxa21Lni8cgDAwEa3YUAOvjs6DONJrMXgaxpMHicg7O87+d s0RqmTgVQyoVb068hMW7kZ8X4IfuKOa/KxRmf5S2BIIEYcyuUln+rPMPUwVyQF23O8/S RN+zXfcZV1ELJyS8p31CrTHD8AqLdPbdTVu11dwM/m2xwU+FZOjzE9CLgwtPvG+tAUzq 36J8l82JZWUM2F6Kpkfg13n/3C1IpT9zr5CP2DplhyiQTZiH4Ocssp4j5aEo+M/J16/O CPe5ZZIYv9Vt9zslJK9vX9dQb1N3n2cXDFi0XRLeP6ewf2cOXfWvA0YSlYMbFVR1aKKI Ri9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="eU/ePzJ2"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q5-20020a170906a08500b00780cb1272eesi97353ejy.466.2022.10.24.09.08.59; Mon, 24 Oct 2022 09:09:25 -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="eU/ePzJ2"; 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 S233170AbiJXQH2 (ORCPT + 99 others); Mon, 24 Oct 2022 12:07:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233157AbiJXQER (ORCPT ); Mon, 24 Oct 2022 12:04:17 -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 1683287687; Mon, 24 Oct 2022 07:56:35 -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 6670AB81178; Mon, 24 Oct 2022 11:42:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCDF5C433D6; Mon, 24 Oct 2022 11:42:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611747; bh=Jhmkst0PnxOYr9CFYZdLcK8CmYezRA+qQmUrSlsWzgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eU/ePzJ2JjB8BTKEVWhjnGaSk0DowMr5JA4QGIwvZkt/HRSNKFIFDaJxlm1fmVx3o eC7XULm6eHsVWtQiw1+CPoS8DVxsuUQPzcWB9ZxtV7NtujJBXe6+QJXL2Mdv0NjZg2 LOoLBsVVYFyjw6U48XrjM+xTBd2j1rWi9vRaRZUo= 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.9 096/159] HSI: omap_ssi_port: Fix dma_map_sg error check Date: Mon, 24 Oct 2022 13:30:50 +0200 Message-Id: <20221024112952.934241502@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 | -- 2.35.1