From patchwork Mon Oct 24 11:31:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10022 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622190wru; Mon, 24 Oct 2022 12:44:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6X+keWrkzP+yhqNGmayzkZuKjwkjdw3uhoGImL/UUcz38jeUeQyLG0eiHDuXWSOEtyIDys X-Received: by 2002:a17:906:7314:b0:791:a45a:bc84 with SMTP id di20-20020a170906731400b00791a45abc84mr27568354ejc.394.1666640697293; Mon, 24 Oct 2022 12:44:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640697; cv=none; d=google.com; s=arc-20160816; b=o2cyxeCnVhxPEM/xRxwyFB8kUqiTPlxHICxA5lQxssn7wH4BakAgBeKQH39f9UcQao doo6HUmbUSHoPZr1rqJDHykKcyyrv3yk5hPlbpRsCwBxcJC2z+2/EWSLGyfBfa7a6Zvd bqI25/nmrQsUNphUJbV3m3Oa3THovj8yHYAffmXPXKvT/cfWZrcY9IsFnxnJiEYg1Qhr tmdJ1x2t/pdf0baDVPbMnOBeaUHYAxdhEz0Qv79h31LqkuAY9jDQG3p0vP2MUaosWoTw 2x4itkuwaaHcrPvtlrDfwcx0bIl5B3jFK9Qb8CejkKACHMid5q0Q/twn5hZL23kjsTjZ nsGA== 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=uSFB3aBODyBJFeKCkatp4CUz4+yGjhblmz/g6pjLf/E=; b=BZcJTwlILvq//V+felmutSVIz88XaMBpUN5jQ7Xx1OoS3U3L4rLhCm+vQy3CarhI0C q9YaPCUVp95k6/2HRnbs0R2fibIdVfvJxV6LC/Gg1kvEy9/WMX+PEdf0Q7Vv7HKGAtJQ 45wy6UNu/5mnpplVeoeJIx5GHmiJmbHWMgLIxWjpwiHOV1ss4OFxYRCavs/voh3kV7AH PC33K14j7Cl6OwcGHClrhnsOUCO1DXP7rEr19o5ugvVbw/LeaonLBP/KDSwKkBdIdbt+ FV/PgiijA1aNmWXhBmawLIIWaWSf4m+WLQAF1LETp/WVmUeaKgNMUQOeamaVP2Oxv8Jn mN0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0wkMbXof; 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 dm5-20020a170907948500b00791a5f0b140si502995ejc.993.2022.10.24.12.44.32; Mon, 24 Oct 2022 12:44:57 -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=0wkMbXof; 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 S232949AbiJXTjz (ORCPT + 99 others); Mon, 24 Oct 2022 15:39:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233628AbiJXTjZ (ORCPT ); Mon, 24 Oct 2022 15:39:25 -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 C509C7C1CA; Mon, 24 Oct 2022 11:09: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 ams.source.kernel.org (Postfix) with ESMTPS id BFC0DB81197; Mon, 24 Oct 2022 11:51:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21FC0C433C1; Mon, 24 Oct 2022 11:51:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612313; bh=J90OA6eZTp0oGiLkAzqf0xGHHm4dRJ2CBpHn1NUQH+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0wkMbXofebdSr1SITsyd4e1zCXhLB0keUkH7clTXjMderfJgdoL3nEWxw1wkd/TtH blO0y2wYO4WL/h8+2XzG7clx+CSRMJDs1hvFXoh5+4u3c9W8KmhdHl1oP3ZMVtm1kW /BZVVlYt1It2YWz19cKM/GbPj0Ap1+o74MmlIpkM= 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 4.14 151/210] mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg Date: Mon, 24 Oct 2022 13:31:08 +0200 Message-Id: <20221024113001.874873699@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?1747599435790335963?= X-GMAIL-MSGID: =?utf-8?q?1747599435790335963?= 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 7e3ed2714630..6e5d59f40a18 100644 --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c @@ -626,15 +626,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;