Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7370185rwi; Mon, 24 Oct 2022 13:40:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4P+TDrwmYQewz6fsYtE7YuGws6EnLdIzl6CVY8laKZQDKznDnp81mPeMErIwyTMwRxTmH2 X-Received: by 2002:aa7:df08:0:b0:461:d9a2:b247 with SMTP id c8-20020aa7df08000000b00461d9a2b247mr4818502edy.54.1666644035670; Mon, 24 Oct 2022 13:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666644035; cv=none; d=google.com; s=arc-20160816; b=i8MwcKTmYILJpQ/WisOnfJcvubIjiUlGqu+44qY9R71UdTLC2Ln6TeGVC6QBSLGfye ZRlbY40+Lm3deiyKIcEAQnegTw2wRKADG5/BzDuep59ajoLb5ni1EPg7NofEKtFYpV4e fzI5FP7c+0qggZP2mmrQZwGXTG0+P34xlm8bnA8pb96hrH9K09Agl7txTjiTfqlkjH7r EoivTtdJ0Azifazc3N8mIR2Q8YEAZlvb4Iq5AXjBChm3NtGiRaPnv7xq7liyu8InWzTO USzaD3r+483Aq46o8Q1Ro5TUcj/+X0oTEco4SZkVESluFhcuxe5ITePAHJACxTTwUZ7r Y5vA== 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 Return-Path: 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.40.11; Mon, 24 Oct 2022 13:40:35 -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 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 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; -- 2.35.1