From patchwork Mon Oct 24 11:31:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642847wru; Mon, 24 Oct 2022 13:39:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JVYB+Svx2mv2tT1wCLHiBqP9iXoYehHVSD+PJfe+YE7NKoTWFKjp6cQGE+RJEhY1gDyCy X-Received: by 2002:a17:906:8a4b:b0:7a7:3e17:7f91 with SMTP id gx11-20020a1709068a4b00b007a73e177f91mr6924665ejc.331.1666643985820; Mon, 24 Oct 2022 13:39:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643985; cv=none; d=google.com; s=arc-20160816; b=QDSsdipXHmSFG0huZjvO5crCcjFRW7rbdN02+YkNjfYczdCAJ+/LX62z9mGPkDNs4f JnELIfvEOgcR4KlZjDHuPSkz5b6zc7Irv2idA6chki8S2NbPD1hhAD3CpQXyZunldqek 1xEbDORsscdeqYD8/HRAKB05OLZAZmotgimR89sFspjUhAT3WQrZpoP4qxtme4pydLKO RAkR+pgcucrwKdK1Fwvnxk2Nkyf9GB8EBmrI0S9xc2+jgJVKjNRtASKmnTx9WWLCYQfH ug1TnIgJ8ky2vlbD35UQDXNBkaP34noiuqw+NyLctuXYsuF68fo8pVCwUsk1ZHausZlP 59Qw== 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=Vdd0NehVAnX4d0T700GtqWmR0cOF83Ce2lYqbGSV9TA=; b=xCc+raRWwhD5Ih1YDdvgNPRlbMndiD1fOfC4TAQgFt1/5SaaKZsfvCTNNuxMbP3Gb2 aWFsPRrHzhhOYI5Ry1SXrIjLo/F2fgz5RsH9zEXj6+YgKMxU+hfQewOBT8GtHDm/llaB ykGO/LS+zPZ5wMfCgC60MvmbUsOD0ig6woydY0PPkp8IuAGrbP5l9pCHNFxkS4m4Gdmr GM3A7RsdPvNJiCcewd2JPjcaCD7l6/kb1YWPVrFWT0pE0hjayI3rqpHtEHRtt2mTq07b eJBefQaKkuiEtK6F2kllYYZ1DV7eWZuwY7j51x0U7S0JUIhfinZv4OKMxUlxQCJrmwrv 4x1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="yOTPdr/v"; 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 dz21-20020a0564021d5500b0045902845795si816340edb.557.2022.10.24.13.39.21; Mon, 24 Oct 2022 13:39: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="yOTPdr/v"; 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 S234565AbiJXUiU (ORCPT + 99 others); Mon, 24 Oct 2022 16:38:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234572AbiJXUhw (ORCPT ); Mon, 24 Oct 2022 16:37:52 -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 AEF985B9F6; Mon, 24 Oct 2022 11:49:06 -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 941E5B815E0; Mon, 24 Oct 2022 12:12:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E563BC433C1; Mon, 24 Oct 2022 12:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613521; bh=mpW9LaTnpHes5AevAZkGKgrZliGsNsmKn5pSYANPHqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yOTPdr/vtz5heIWqE7AZgh5p6k2iMvWRyvA9KOrciS+Gzissuk0Jtt1PgpAXV9z2F WvLL82iKHYSVmMSOtOzOGaULCAHbj0oyOlprx2I13tJIjo1r1C+T/S0ba9FZdjcVAP Dk+/4xzhVJq1sELvf9Ra1aFXn5RG2EvbkI4PFMpA= 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.4 169/255] mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg Date: Mon, 24 Oct 2022 13:31:19 +0200 Message-Id: <20221024113008.383353567@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747602883672309102?= X-GMAIL-MSGID: =?utf-8?q?1747602883672309102?= 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 8ee9db274802..f7191dbef6fa 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;