From patchwork Mon Oct 24 11:31:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8828 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431349wru; Mon, 24 Oct 2022 05:43:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DI9Bniv7WNfIrNEVrvpMSW73bd3gEOLVQyZot5xfXi+CgMdsZdglI7PsR+0BpU+iaDiVp X-Received: by 2002:a17:902:ced2:b0:186:9803:76bb with SMTP id d18-20020a170902ced200b00186980376bbmr9420460plg.83.1666615413138; Mon, 24 Oct 2022 05:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615413; cv=none; d=google.com; s=arc-20160816; b=piJb2z3JvCzQBOZRJj5FYMkVUTBPPu4mx9h0RHc3U2rP+T3rvHPxKy0Z8l4w12iIMZ 02Bhm8DgZBoVW1k0bwECVAsWniqFPw7cYh/57KvPnW/kaOyHCHCyTsltORBMhvb+nWiM uCKqbIe1pbgT2BOVGAin/erWoIFcc/j5JYyP9Vzc5LpvuJdbhnTCprmiyyMXpRPxuZVQ XEqYDeXxbsiVZek6rBPsAaO8pHwmE+51q1fn54T0HYXuemRkD5mlSPRNnl1EbrNdvZLl 8k/SdRYnDpAB74Kt049zVfldLy304HO8clUtKSnFEZ7oeSq/UtMFcszvyYaWTVoeCrGJ 5Glg== 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=dKR2KIQ6XAAcEXroS18qrcaqJIIpeK8+drgCLait5kw=; b=rnccaV4f+npKC+sJjwIwfB8Pl9lKSmGaOUaCctiDJVZ1tQKMMvXAFqOYSDZQVmWAEI erWmceiImFGIveTiJ8T25KJtiNMJp0jJTXLv4HuUNAqV6eDWFuLy9LspJcSrDXZBffcU aa4lECKu1NbJzdkPH+X3750ecBrOzalwGoTDcOcMkbd/ZMQqZga18jeL49MMEybYrpBk EJeIMB+g1tGjcPfQyzBPw4AA0Kk0sgRNSCLiPIyvXHiVxWb2fPSSY4frL6pweU8TsBN5 1Itn2SCjrzmjEGfwguTHgA2gPHgAmRFmaj372fN4fkj2Zd3ZPOyxwaaaaglfdpi+1BSQ pOVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VmUb94R9; 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 e11-20020a17090301cb00b001787f1922a7si43947718plh.19.2022.10.24.05.43.12; Mon, 24 Oct 2022 05:43:33 -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=VmUb94R9; 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 S234501AbiJXMfS (ORCPT + 99 others); Mon, 24 Oct 2022 08:35:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234243AbiJXM3s (ORCPT ); Mon, 24 Oct 2022 08:29:48 -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 05136895DE; Mon, 24 Oct 2022 05:03:44 -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 DCC03612D2; Mon, 24 Oct 2022 12:02:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0894C433D6; Mon, 24 Oct 2022 12:02:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612972; bh=frh3ChJeHGWvclmldQc8G3du3v9eRy5i/YPzCKhzBE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VmUb94R9hyyfBN01ngbXQwAUIytU+6LshE2HZwnxoJaG+YL/YCt7AM6yzAYPiMXXq GUawSdSiVt7fvIIGSpc6FH2ULr2+lZ098gSRXYul54xpM8KWyG6j35hBn3Im4YzaUG 84QrgHhYK1R5yhZJbR36GG1XpMwLwCp+OSoeMEy8= 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.19 158/229] mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg Date: Mon, 24 Oct 2022 13:31:17 +0200 Message-Id: <20221024113004.114523680@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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?1747572923462993491?= X-GMAIL-MSGID: =?utf-8?q?1747572923462993491?= 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 96bcabfebc23..543c4a4a8fca 100644 --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c @@ -634,15 +634,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;