From patchwork Mon Oct 24 11:31:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10264 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp644656wru; Mon, 24 Oct 2022 13:45:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5S0maejIFcb0vDi7Ji4J6ZmEt65XxhsDSWi5X+A6LuxbLeImoYZaN/WzsZPVROFxIAnT4L X-Received: by 2002:aa7:83cd:0:b0:563:5f54:d78c with SMTP id j13-20020aa783cd000000b005635f54d78cmr36346015pfn.66.1666644342806; Mon, 24 Oct 2022 13:45:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666644342; cv=none; d=google.com; s=arc-20160816; b=yFypkghL/2KueumJnt6HjFlOe11AwMpw4DVGUDQAF2e3Bn6AqFp0sWQe5DkU1F3xOh F48ya1atQmxq/BLLUuSuFT+fft1ApfYlRzCpRGbIN882OwNDfTSd4TMdqWjm3KrXGOTb dMzHMC1R1cfd7DTR2/rsIwkT1s+DavnoWTvRIDtWjbl0fEVfIdENOVjaewpEtCRWxknB MhO1KTPmgnp+KSbM2UNzfjpV9VXDb9tXxDxfOWaiDJI283WMfki5rqaNdplVauOFwqA8 NhcyirEFfmBtWWWLmaajO2GSk/yEJnKjCGzUat7/VNhNBLcpm3wdWfIwdq4kZ2l+i1UD Q3FA== 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=e5CTcm/hkJq8CAXMnu+4rPmgtgmcpQdT1k2ecSMEtLk=; b=Vz0noS7DrCSFBptArCSegVQUK6j1YWJFZ6wPTOyn5SQp5njTXMmx8EQ0O9eEXUZpaa udpPMINGgKJaUwsqUY/EdXf3QcLKnwCTdOPp3x3V7kxELNU+1hPTDjQwdg9lrjGyKeTJ vDgZ8WV8qcKDjP7suZFxq+cxGyxwPy6F1DEZ3VgMoyfvziWAcEz3/H7nrwJGHBPGAX55 pwTF7up1ifu78hzCm+B7GnYnd0DhQsNdmMqkojwmH+RPMc7w8QSyDPINpvEyswpgA9Ab GdRGixj2gbnR4pvrZ52pNPoWQ6M7t1hJosK1N1VXLjFHHkEgIolp5JjzjHtfOlo4J4sA PXbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hToBVyC+; 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 g11-20020a63564b000000b004403e01f82asi551253pgm.230.2022.10.24.13.45.28; Mon, 24 Oct 2022 13:45:42 -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=hToBVyC+; 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 S233353AbiJXUne (ORCPT + 99 others); Mon, 24 Oct 2022 16:43:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234736AbiJXUnB (ORCPT ); Mon, 24 Oct 2022 16:43:01 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86DE8249893; Mon, 24 Oct 2022 11:51:16 -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 sin.source.kernel.org (Postfix) with ESMTPS id 3D0BECE16DB; Mon, 24 Oct 2022 12:50:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A156C433C1; Mon, 24 Oct 2022 12:50:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615801; bh=KtGQp74GjUm4fjBDfc/e1bqaUuqJ4KqtnZ46BIA9LVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hToBVyC+X6u9zICjx6DIHjcc6nxKvEY8D5FUV9W4jgg3TWRW5tUGZ1oOJDIj/Bn64 P+s6atLQpgpzDKMRxn9nX5V7/VSWLorTVzJkdq48QGtGpDdGlCRWisCeQ/p2Ltlflf gJPWdBaoTfZDz96Avik7LRM0T3UikBO1P+l1gAf4= 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.15 361/530] mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg Date: Mon, 24 Oct 2022 13:31:45 +0200 Message-Id: <20221024113101.392155581@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@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?1747603258716496847?= X-GMAIL-MSGID: =?utf-8?q?1747603258716496847?= 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 78073ad1f2f1..b7e9fd53d47d 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;