From patchwork Wed Oct 19 08:31:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5225 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265896wrs; Wed, 19 Oct 2022 04:23:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7c6CamcRBVmHzB7eSXUTTJ9JgexdzJMILsNYMQP8neVjBYN/NTAfHdNYcAYF5xeZeFXFnx X-Received: by 2002:a17:90a:f016:b0:20b:a65f:af42 with SMTP id bt22-20020a17090af01600b0020ba65faf42mr9195329pjb.79.1666178605479; Wed, 19 Oct 2022 04:23:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178605; cv=none; d=google.com; s=arc-20160816; b=HtnQndc+aKQCMFPxhJN/xRcStvufB4cfzk+uXA1Pja3KnApYBSU4GLNmYQqZzyYHI4 r/P4/4GgMnKuDO5HY2ChtEwSUD1+xfaipDBsFUIFueI1pzEUG2R2A1jCugMATd7R1//C KrjmdYLreY7AhvzMFlpc/GThRWSgYISVbGXG+iAwhqODfNzEhjC/Fn0bJbpzwHMrMw0y L0ptEndKPP/NW30tx5l9nfdSMLOlcLAV9UKV39rbZHUNzdqpifEaDlv4oaAR2bFVdP4C gOaaS+CyOQeIUXdHt+Y4TF4gxVD+MiXhoWQrVOzVzYMfNLg5Bi3tn7BhErcz3BZGNomy 1M4w== 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=ypV0HJqxvtZbEQ6JlEdcxcOuL8BwnALqC6YIC1VN6j4=; b=EXWsiolpKGtc0HWp9EoAJJYzL2dQDry6Dr4U6ubq1OXQ4blvYpEJ6deVs0KsnbBPtb H8iFdRk7xc0LoLxXREsBVs9IpghiLONJlHlKTG+ji+uKXECbYpiw2NWvfTJUf8zMPI5X SVCiSBtE5DhJcwTABoty977rnFN/w0QWO+sTqy87gAZgjI3FEkJl4f5TQDAvsAd9z5pO +4LbfGqr1draeTLCGeZzYXTx9Ik5q5WvEbzq/YgJaEsiTt1I8pfUuS9NShWluP2LsvJk P0yW8YtMQXcd3gMLHoKOW4yrPQ6xD4OWCupHvpQVmhimj4WwwHnupIlDOoUcbaBPGjST Bgsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KAcYywsH; 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 j65-20020a638b44000000b0046b2ebb0a4esi15525353pge.212.2022.10.19.04.23.08; Wed, 19 Oct 2022 04:23: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=KAcYywsH; 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 S232848AbiJSLMI (ORCPT + 99 others); Wed, 19 Oct 2022 07:12:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232752AbiJSLLM (ORCPT ); Wed, 19 Oct 2022 07:11:12 -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 51582153835; Wed, 19 Oct 2022 03:38:50 -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 CF590B82334; Wed, 19 Oct 2022 09:06:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44479C433D7; Wed, 19 Oct 2022 09:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170398; bh=BaI82+rRrrtiUMrTa09afa+nj5px1HQoMoRsf7VXukE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KAcYywsHykvqeM38DgQfXuy2Jqh10AUDY1rgcDnW82sKKRGG8Y8svqd+IPmXU+V7S xD49vCXuHWSdABnSExukc8hN7d5My8TURM4IMVy666jqJ7H9Hk0lZmVHX05Pvni8na 24GUobX6hE0aHrEUgwt9QwcFeSswS9TzYwovp3qA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Wang , Jassi Brar , Sasha Levin Subject: [PATCH 6.0 605/862] mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg Date: Wed, 19 Oct 2022 10:31:32 +0200 Message-Id: <20221019083316.678797029@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?1747114897296037656?= X-GMAIL-MSGID: =?utf-8?q?1747114897296037656?= From: Jack Wang [ Upstream commit 6b207ce8a96a71e966831e3a13c38143ba9a73c1 ] dma_map_sg return 0 on error, fix the error check, and return -EIO to caller. Fixes: dbc049eee730 ("mailbox: Add driver for Broadcom FlexRM ring manager") Signed-off-by: Jack Wang Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin --- drivers/mailbox/bcm-flexrm-mailbox.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c index fda16f76401e..bf6e86b0ed09 100644 --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c @@ -622,15 +622,15 @@ static int flexrm_spu_dma_map(struct device *dev, struct brcm_message *msg) rc = dma_map_sg(dev, msg->spu.src, sg_nents(msg->spu.src), DMA_TO_DEVICE); - if (rc < 0) - return rc; + if (!rc) + return -EIO; rc = dma_map_sg(dev, msg->spu.dst, sg_nents(msg->spu.dst), DMA_FROM_DEVICE); - if (rc < 0) { + if (!rc) { dma_unmap_sg(dev, msg->spu.src, sg_nents(msg->spu.src), DMA_TO_DEVICE); - return rc; + return -EIO; } return 0;