Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp296301pxk; Wed, 2 Sep 2020 01:15:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyx4ByPKlLlVLdpkf9aV9nv3YXh8ONWLiWkla9L2N2v59qnvG5Np8b4KeRY0JFa8Hs6mXGZ X-Received: by 2002:a17:906:1e11:: with SMTP id g17mr4819006ejj.298.1599034516855; Wed, 02 Sep 2020 01:15:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599034516; cv=none; d=google.com; s=arc-20160816; b=cYo0WV4wK/vv7ASrF3k/BNuVqOepQwaCB8hhKPUFnFFPlgSyTlYJ5FuXarWYLj7WYK zTII9HTWPgBR4VtjBui703iR41mnAbK7iV/tu3I8M5r7DnHKtyn04CiFTi/2v6ZGv9Mi I3Qr74IJ5fkZDlRPkmR0k9VVXAq3+LbS5OxcrZW8L/WmW3Z87juLaiXj39SmsUEn7qw4 e/nWAuIejgMi4Aza0ASbw3wOfjN0KepGBanivXIfNsPUIGEjZAB8OsMFEFI+Rq90X6Xr zlWULL8QibSIr/pZOrqrKctSl04Mcpimn3qPVr0I5p6YpLqKt6MjpGrPem/h+2cCHpy8 Yiqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ajw6qJ0HK9f84NaZk02ueiqf5FMBgGA4YB4Zctqo+q0=; b=lz2VV4JhxgeDijeMYOE9x1F0wAdmA6dvFPjWNu2ZmRnFW6XCCOb13In2CKGFBCPcTS Exh4xaYWOXOrOq8kCVl8cEw7Vk35XXD3EReYeEbodRb4aUI7aqbcw2BG1aMq2jJ7WcFv oIbJZwXFthrbNj5KZvQM2IaXTQ5QVujUoOpWhHAsdrLA0v/ZP2vQ8ZafKR6odo8BeSeI U/9Gi+SBB+ZN5w7vkL1cB/oz3H7OP2GxGOTT8j0p3ZWKmR0Ly2ZcIpOnTSF/+e8Exz7g PpPhacoa8JukYn+CCJ1iTLc6HrgTctL65+N1QEmcwA9LHWOcTtpEZY0dYrhBPfCjkT5W 4yuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=La76+VbB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m16si2060303edr.280.2020.09.02.01.14.53; Wed, 02 Sep 2020 01:15:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=La76+VbB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726479AbgIBIOI (ORCPT + 99 others); Wed, 2 Sep 2020 04:14:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:36546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbgIBIOH (ORCPT ); Wed, 2 Sep 2020 04:14:07 -0400 Received: from [192.168.0.50] (89-70-52-201.dynamic.chello.pl [89.70.52.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 29E232072A; Wed, 2 Sep 2020 08:14:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599034446; bh=5D9PpWt9bWuDNc203FjduFMM/5rtLKQAc3pFFPBSd7s=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=La76+VbBkCekCKyKhOMiO4ukzogPXQcPXmTsjW7CUn9XuTVaaKXRgbg3u/h5UPNUg QDS9DQeALQK2dw8H2YN/NHsXzgeLwX5h5dOhachsvz6725rDAKReavMhrfX3f08oyk /naVL0/Hw7IwW/K/aFlHGMDNDoaXa0wVYHhIJRQo= Subject: Re: [PATCH v2 6/9] spi: spi-s3c64xx: Check return values To: Lukasz Stelmach Cc: Kukjin Kim , Krzysztof Kozlowski , Andi Shyti , Mark Brown , linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, m.szyprowski@samsung.com, b.zolnierkie@samsung.com References: From: Sylwester Nawrocki Message-ID: Date: Wed, 2 Sep 2020 10:14:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/1/20 17:21, Lukasz Stelmach wrote: > It was <2020-08-25 wto 21:06>, when Sylwester Nawrocki wrote: >> On 8/21/20 18:13, Łukasz Stelmach wrote: >>> Check return values in prepare_dma() and s3c64xx_spi_config() and >>> propagate errors upwards. >>> >>> Signed-off-by: Łukasz Stelmach >>> --- >>> drivers/spi/spi-s3c64xx.c | 47 ++++++++++++++++++++++++++++++++------- >>> 1 file changed, 39 insertions(+), 8 deletions(-) >> >>> @@ -298,12 +299,24 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma, >>> desc = dmaengine_prep_slave_sg(dma->ch, sgt->sgl, sgt->nents, >>> dma->direction, DMA_PREP_INTERRUPT); >>> + if (!desc) { >>> + dev_err(&sdd->pdev->dev, "unable to prepare %s scatterlist", >>> + dma->direction == DMA_DEV_TO_MEM ? "rx" : "tx"); >>> + return -ENOMEM; >>> + } >>> desc->callback = s3c64xx_spi_dmacb; >>> desc->callback_param = dma; >>> dma->cookie = dmaengine_submit(desc); >>> + ret = dma_submit_error(dma->cookie); >>> + if (ret) { >>> + dev_err(&sdd->pdev->dev, "DMA submission failed"); >>> + return -EIO; >> >> Just return the error value from dma_submit_error() here? >> > > --8<---------------cut here---------------start------------->8--- > static inline int dma_submit_error(dma_cookie_t cookie) > { > return cookie < 0 ? cookie : 0; > > } > --8<---------------cut here---------------end--------------->8--- > > Not quite meaningful IMHO, is it? dma_submit_error() returns 0 or an error code, I think it makes sense to propagate that error code rather than replacing it with -EIO.