From patchwork Mon Oct 24 11:31:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9310 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp465032wru; Mon, 24 Oct 2022 06:51:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7DGc41hZFq7pqRDWK9Nmv8Kn2kxQ08p5BfHfKOmLnDJ/pj+hbHu4XTWQD9pvKgEDXXEknm X-Received: by 2002:a17:902:e807:b0:185:534d:4bd3 with SMTP id u7-20020a170902e80700b00185534d4bd3mr32041973plg.26.1666619505810; Mon, 24 Oct 2022 06:51:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619505; cv=none; d=google.com; s=arc-20160816; b=tf7OcF5mBvA4fooxNhdYZcLz34L1qI+k4dE9iuKWPdLb+KN5nvHik0oI61tGFW/szn MYjBf0OTefqceuIPqwGOKabuD/IppZpUAmzNW3Yh/ZNPG4pbTxQvPW53ZlrmX1k4c6Si BS+v0EeaCu/JOJ4k2u6mJa6pmBGVvyTRx5HLW3k7UdtFe/bXbmo9CZ6kGG7TgnIBIryy S8IrVwNaXJqegGGgU9Bi7pR5hcQ10qpgsWqsW0AMcmOWT/B00Gx1v0Urht5N7Q1iV5a7 Wz8WL71AENDdGogjbq1q2aFujhFDbunBqrsm2a3f8fXuTsu2Mg4E7oIu6ySaa7NnxG2y Shag== 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=9RR5N0AorShVpTQBtOpomGrrxJoCwpqj9PDxq4B1+Ac=; b=h4ov7LEDQ5jp6un0McFBOiwFjZHFAIKthnmOPiI8MjoVj2/g24ObB66wooUe55WSIl tBGdD+1hoJCJ5QPG0fetiZYaV18WkWBIMx9t8nyT1als56uKKo/h6rPraulIgFQBoH3Y mZztxKOTEJdcMyu/uqf/5xRiwe8Q/6xj7ci2N/1alVh6oxiVmaahflUHnhspRvX2ZxmF rgA4gn+jfeX3IRU/JhYVf9OCScINdxq5Eh82U5ny8TcMBoIqEEcSjUnCeAv6AtZ8jQZf L2oG/Eya/9jbpFnLCXUFJuUAjp0Hfs1eJzEvtzyuli7aMTeru+hPJ0FsEfoV+WFZCmhC ySoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KXrfiV64; 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 t2-20020a056a0021c200b0054d5253e7d7si15216968pfj.190.2022.10.24.06.51.32; Mon, 24 Oct 2022 06:51:45 -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=KXrfiV64; 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 S236530AbiJXNuo (ORCPT + 99 others); Mon, 24 Oct 2022 09:50:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236679AbiJXNtl (ORCPT ); Mon, 24 Oct 2022 09:49:41 -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 4003CB8C39; Mon, 24 Oct 2022 05:41:43 -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 AD195612E1; Mon, 24 Oct 2022 12:27:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C20A2C433D6; Mon, 24 Oct 2022 12:27:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614442; bh=krC0t6qtfnr3qlEDbOeoZ9RVBO7XPwtUOgKJvaaBlDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KXrfiV64x+RGiDh4z3ERxSGmyL8GSy3JTaEeak3R6EzQb/oWIAQh7E8OyxzGuUWmd gmId3xS/+gKFDf/wFnSe9sHN4qO+yd3NU8crgdcAygP+gSsUeF3Iwev1rGOexwBzrM 3uitSdrifQ0Qkjk7TPZrnadTRVVrZtRfuP0Q3KfA= 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 5.10 263/390] mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg Date: Mon, 24 Oct 2022 13:31:00 +0200 Message-Id: <20221024113034.090423319@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@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?1747577215257057301?= X-GMAIL-MSGID: =?utf-8?q?1747577215257057301?= 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 bee33abb5308..e913ed1e34c6 100644 --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c @@ -632,15 +632,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;