From patchwork Sat Oct 22 07:26:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7565 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106059wrr; Sat, 22 Oct 2022 01:36:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM661W5KKK1xfZ4nw0zBFBUv0l5Kir21sCdZVVaUoz8jFB2oRr4n1W3MgsabBIRbIE9Idlu9 X-Received: by 2002:a17:90b:4b0c:b0:20d:7ffa:4b1b with SMTP id lx12-20020a17090b4b0c00b0020d7ffa4b1bmr61585571pjb.16.1666427806849; Sat, 22 Oct 2022 01:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427806; cv=none; d=google.com; s=arc-20160816; b=lwgLdp3tKSCWOanCR65Ap4UG0PHF4W++kiANLkiN5o9mhjk9bDXIFjyD+N35zJQHTh Wn0hnufhWBh//xvlccbvg7yqEW1NhYpODRe3QkcUIupYWr3AG+l4AnXz3dtwIyKJ2LLP pQHFq/3KR45jY4YXOGYzBva2kjihP98bxFqdVio9y/YN1vqS3XCj2tp9RMPPL6HvYyuz /IQDDBmNPrD2c0Brdm6AxRATG5Uuayw2nDevzEYT9iNiHLPoFqDW7CFJ4eGLmaXEZ9Mv DTIU9i50yBnZB0dvkUtM6wR4PLkm/O5f7Ccnfocjc2y91RAtAnBY0BHPhT2i+PdLtgUH ajMQ== 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=FW5OnS587ciysSEyCoOCmInYNbaDeeqoIsizsVvMWS0=; b=oU+nQqiiyAwXsTZbQoNagGCEeTiHo2qvW1U7wQkNk/8QrbDd9IuzI7+YybdlsutP+X D/D8oMyjDaxBSMpGFUOT5UFlDVRsfSPwSvxz8udA3kELX4sRCRPoniSTu8vo2xlKUTuE j2BNqccPvMObLsor+FFEy97KaHxQm60dQ8IIMbLrJQE1UwhPAdJs6LsZRcqSdA6xit+K hMlULfOX66EWmAk9USM1VbjVO+xZuQB5h5aYjjih9tVgB27ejh/SqxkU1fekJqEsbGNt RPNJH2wasjm//IyKMxvwpak+vidPs3OixVsX4ZGGSPfJ+kR/JGaJ1t53wqiDC9mhMt/o eynQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=04SKokKW; 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 l191-20020a6391c8000000b00460358671e2si27154060pge.547.2022.10.22.01.36.29; Sat, 22 Oct 2022 01:36:46 -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=04SKokKW; 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 S233844AbiJVIVs (ORCPT + 99 others); Sat, 22 Oct 2022 04:21:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233499AbiJVIUK (ORCPT ); Sat, 22 Oct 2022 04:20:10 -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 8B2623BC6A; Sat, 22 Oct 2022 00:58:37 -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 1A81D60B76; Sat, 22 Oct 2022 07:58:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D03FC433C1; Sat, 22 Oct 2022 07:58:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425491; bh=PAWe9+sr/8pCcusCMevO9dufsJtfvbqu//B6LJb3YgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=04SKokKWA5iMFYXrOEsi5sd/15nddZKrOgvyJG1cL5zJjm2Bleucfjlj6OzqxstHj 1yP2e678UtzBcE360jRLN696cDFq5jTN2CFNr4OL+Skcop8iQXvCSoTikG6MUMO/VU nYtwNATn1CCkWSlGi9dgigbyOBPb/nRW79GtSot4= 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.19 491/717] mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg Date: Sat, 22 Oct 2022 09:26:10 +0200 Message-Id: <20221022072520.035256552@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376203924966470?= X-GMAIL-MSGID: =?utf-8?q?1747376203924966470?= 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 22acb51531cb..658e47b21933 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;