From patchwork Wed Oct 19 08:29:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214833wrs; Wed, 19 Oct 2022 02:13:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40b5RnOdbNc+NTvvb/JlIyg97YM/4SIgFj1vnX28DYNQRkDkdx5D+/M7mo6PFklkGtUrzK X-Received: by 2002:a05:6402:1f06:b0:457:149d:beaa with SMTP id b6-20020a0564021f0600b00457149dbeaamr6392433edb.238.1666170833736; Wed, 19 Oct 2022 02:13:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170833; cv=none; d=google.com; s=arc-20160816; b=KMUO42dKYd6rZbAI4X8aqhohCFwI581s22L0JbSCq3ZiXYbeU4b3CNeW/x2TV4EnZt fbsc1UJuY7+tzIpqlhYhlyicEe34Yn2VoSYMz1Me/rGkDh+WNVFUutQ9+K3v/bdD3xDY zskNVOtSjVE5H1WNjJJuJOJXxTvIsASUqoVsdbCLINoO3Bkq2ean9hHod5Yp8VhcNQu3 7+kQbqRjLFWYSwGrn4cPbW1h9vt+3loVbFbz7DWO8MFHIbO7CoJgzX4MOABDhKQVxA/N Ar2SmS77eerOnE+jxEaP/6LPq6zK7P8yDCxIf9QPDBXkcs66NlXR+YrA4U0JJ1Wwo/r8 JPWA== 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=ygMQmVaV6uB3wDs3pIY4KlLKY1AxBOO2OwRxRIC7my8CdA/qptSPhkhy0kQZ6hbFcZ 6hufglccIHR1ihte31/ylV7M1AokryE1cd4kxTyDXn0baqePzvyDkRUgddmU1Os0nRbB CXwi0tCBmlABovWofYIM00ZKRLI2lv9q9rrfkIlBTuT29gcbcAuO+AeWkWRk/xhdErNy FQAQlY2Wnaz1oen/p4sSEWQCVrUdUGMKleHeWWieUEicubw3dz48slfJAdmYQ4Ir1b12 cp49YmD1Pzxg/LDvhbYWf8EFHhk9KJpmgxsyiJwvqKCY3duk9vKGnFsAPhSQhhjczMxT YL9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Pw+N8GHs; 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 bo17-20020a0564020b3100b0045c234508e2si11544856edb.627.2022.10.19.02.13.28; Wed, 19 Oct 2022 02:13:53 -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=Pw+N8GHs; 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 S232935AbiJSJMa (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232951AbiJSJJp (ORCPT ); Wed, 19 Oct 2022 05:09:45 -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 17C33B56C8; Wed, 19 Oct 2022 02:00:56 -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 BF67B617E1; Wed, 19 Oct 2022 09:00:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5B8EC43142; Wed, 19 Oct 2022 09:00:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170056; bh=K4roTK2fnCmQiAynGRZx39W2zSKfyzroDBihQQeCMlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pw+N8GHsRqCxcGK5wXsJPGC90NdVNOEp63Am0gw3tH3dPV/FXh20AR10kycdm1whc oPu8XJG7t4/B8LXCSSiEGoC9yzOYNBaSHR1oR2icFXhDVb+UBW+Dc3xSwqroJpvxXf 6jO7bW7Vp6TMjrIGCcGK0+jOZP7BPXz+z2/XtVPc= 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 6.0 483/862] HSI: omap_ssi_port: Fix dma_map_sg error check Date: Wed, 19 Oct 2022 10:29:30 +0200 Message-Id: <20221019083311.299189675@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747106748077940785?= X-GMAIL-MSGID: =?utf-8?q?1747106748077940785?= 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 |