Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7311171rwi; Mon, 24 Oct 2022 12:45:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6fs2J+bdem8zUhqBhHHZ2L6QzonuIfl2dGoPuoAqpYMckPLDIB4ADtu68lboj0hWakRn4h X-Received: by 2002:a05:6402:34ce:b0:45d:14c9:c522 with SMTP id w14-20020a05640234ce00b0045d14c9c522mr31937063edc.160.1666640754154; Mon, 24 Oct 2022 12:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640754; cv=none; d=google.com; s=arc-20160816; b=xb8thtfOKxF+S43v/LC+pR09sRwsDiHKteXe2D+x9RMXBU+sEEuQufINCbOXDRS+41 +BSWy395W1h/AXVeMvPqWNubNR1TrJil3/ButKIZh0s3TBMmD4io8aG2aJ6zib0OuHPJ 6XbGWmSq0icMvOLZOY4C2qNPUJRrlSalBz1tURV6WgQrZoPQmKzHDLSfTFCRKyBhlX7+ J9FWp5xnYVfOg2UDjN4EqXsAmIuJQ1g/LSTvTwqUe09lnX/yFZ2JTe0nsm1o9M+IdGAD BSSDX1fgXsd9xMa5Z8zq7qC+fzKicdxdPOzWF6Gu4Vz0RpdbZExbnYc6zcQHqz93rntP kEGw== 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 Return-Path: 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.45.27; Mon, 24 Oct 2022 12:45:54 -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 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 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; -- 2.35.1