From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEA06C433F5 for ; Tue, 16 Nov 2021 16:31:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A55A361357 for ; Tue, 16 Nov 2021 16:31:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A55A361357 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sefJF/3/sFf9X5/ec/EY9kbjrKHZOI/yK9Vt4lr8NxI=; b=uOXe/MMavOejuB aXufrWmm1TsBP2n36qV8suOCeAS3LX7fpuu/LIs4kkB9a3CajOpZ1TBAwmYrbsvrgUPPtaz95jsmI a20Jcf1pJPAg+Oaz7vwWTJ6E/JT/cg1FG9kEp01ug9ZZf4aTzUQsce77hpKITnI11M2oBgfKzPdTq FW0QW6UNRTZbLeN3ZpDDW7eZln3mf3Bemc0iyUdjtGPijLnkzmydFpm2w2F2132ztFZIlzLf4db/w xmFlhLQiHxEKfd2v7xg1pqXwYGjWDdftuIWNYMy2gbHvfhEIrOWrXk6VW94kmyemcVCfhoXJTQOCl 5JGOWOdsI3S+wdB7vFuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mn1L7-002Kql-Kv; Tue, 16 Nov 2021 16:29:45 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mn1L0-002Kob-Tg for linux-arm-kernel@lists.infradead.org; Tue, 16 Nov 2021 16:29:40 +0000 Received: by mail-pj1-x1033.google.com with SMTP id np3so16169870pjb.4 for ; Tue, 16 Nov 2021 08:29:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dphYgpIFf0rnfxxApXcaDzX6iKxIk2pRdbaTqHCVXRQ=; b=PmThZsEUqMY7qdCDMfNLyXiaxisDMPo6jKmOfYyGgBQ2DTm7GoJthIXRl9FdC2ezGU OuYwc8SuytJsQbU44keukL3A6+PKqb6Y2/5qdTFFtYlH4+3KPsSKP73l3ecIN/dXRTgw b0PT53igfJJXLJQy9WvG6srIyw/uySkwOnhtwmc/gmAMo7PcI0yEzCJwF+ke4ywuloOV zm3bpXUWWk30KgajeRdiOE/dlCqi/ITgDtQ1598NzCAQ9XsrgfIIZGg49YJHSdamuAY8 GIQCzqM4/iQhbUyln+9l38Y9a71xnozyqTdxGaGBLXY7JCW7G8jG5xLYZ+CJzU3e7Rzz bZow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dphYgpIFf0rnfxxApXcaDzX6iKxIk2pRdbaTqHCVXRQ=; b=Hu2nvE02+YWjbvwfXqXFEj2EyCTqg8YVZstN3tIFw7PY/xhgsNaNUwGwKEq+UUwnBn rkjEF5JHHTEtuKsD8Tn8vp/DGCzzumdqLd6Xz8R3jJDPNsEauN2EPpBJULO0TLEzwlXG auEFPOFeL1G+yDEKQcwhfN0ckLySvTamcSqj2JVm21TjxIIkOq44O2L/4XhF6EUmtu3b 9DXcAIdT3iTNS2Hit1OxC1PHgzsr0W2B9oVM0RQbtqowGPgruVIrwBc29U5in96+RLZz s0xgjZvYNnwVgjl8j1UEonyIjISN1+KfqJNcxy2I9svAgW5OHbOxBviBp9YK5cT/gaKn ZyFQ== X-Gm-Message-State: AOAM531BctUbvlBWIOZxQluMLjRkmqyTBJD3VB9hCF1BHbVDWwem/cy5 eU45vcvPTZcApcKq1B1b1jy70g== X-Google-Smtp-Source: ABdhPJzNhkmZsE2FtYjflTIfgzGr118ZC041cPjft4yj7PUlFeURqWKuWYM+CAB3hsODsn/7lztJsA== X-Received: by 2002:a17:90a:8815:: with SMTP id s21mr382032pjn.82.1637080177122; Tue, 16 Nov 2021 08:29:37 -0800 (PST) Received: from p14s (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id h8sm21276476pfh.10.2021.11.16.08.29.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Nov 2021 08:29:36 -0800 (PST) Date: Tue, 16 Nov 2021 09:29:33 -0700 From: Mathieu Poirier To: Mark-PK Tsai Cc: bjorn.andersson@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-remoteproc@vger.kernel.org, matthias.bgg@gmail.com, ohad@wizery.com, yj.chiang@mediatek.com Subject: Re: [PATCH v2] remoteproc: use %pe format string to print return error code Message-ID: <20211116162933.GA2318486@p14s> References: <20211116135703.19432-1-mark-pk.tsai@mediatek.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211116135703.19432-1-mark-pk.tsai@mediatek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211116_082938_989559_BDBB4633 X-CRM114-Status: GOOD ( 29.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Good day, On Tue, Nov 16, 2021 at 09:57:03PM +0800, Mark-PK Tsai wrote: > > > > > Use %pe format string to print return error code which > > > > > make the error message easier to understand. > > > > > > > > > > Signed-off-by: Mark-PK Tsai > > > > > --- > > > > > drivers/remoteproc/remoteproc_core.c | 4 ++-- > > > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > > > > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > > > > > index 502b6604b757..2242da320368 100644 > > > > > --- a/drivers/remoteproc/remoteproc_core.c > > > > > +++ b/drivers/remoteproc/remoteproc_core.c > > > > > @@ -575,8 +575,8 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr, > > > > > dma_get_mask(rproc->dev.parent)); > > > > > if (ret) { > > > > > dev_warn(dev, > > > > > - "Failed to set DMA mask %llx. Trying to continue... %x\n", > > > > > - dma_get_mask(rproc->dev.parent), ret); > > > > > + "Failed to set DMA mask %llx. Trying to continue... (%pe)\n", > > > > > + dma_get_mask(rproc->dev.parent), ERR_PTR(ret)); > > > > > > > > Macro ERR_PTR() is used to convert error codes to pointer type when > > > > returning from a function - I fail to see how doing so in a dev_warn() > > > > context can make the message easier to understand. Can you provide an > > > > example? > > > > > > Hi, > > > > > > When dma_coerce_mask_and_coherent() fail, the output log will be as following. > > > > > > format log > > > %x Trying to continue... fffffffb > > > %d Trying to continue... -5 > > > %pe Trying to continue... -5 (if CONFIG_SYMBOLIC_ERRNAME is not set) > > > %pe Trying to continue... -EIO (if CONFIG_SYMBOLIC_ERRNAME=y) > > > > When failing, functions dma_coerce_mask_and_coherent() returns -EIO. > > Casting that to a (void *) with ERR_PTR() does not change that value. > > Since variable @ret is already declared as "int" the real fix is to > > change "%x" to "%d". > > There're some other drivers do the same thing in the recent kernel, so I think > it's fine to casting the `ret` to a (void *) for more user friendly. > But I suppose it would depend on the maintainer's opinion. > > So how about previous patch I sent, which also fix this issue by using %d. > > https://lore.kernel.org/lkml/20211102120805.27137-1-mark-pk.tsai@mediatek.com/ I had not seen Russell's reply in the link you posted above. I am not completely sure about his solution but his insight and guidance in kernel programming have precedence over mine. I will take this patch. Thanks, Mathieu > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel