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 2926FC433EF for ; Tue, 16 Nov 2021 13:58:27 +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 ED90861B98 for ; Tue, 16 Nov 2021 13:58:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org ED90861B98 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com 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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CfWyCo2R+qoMUxFp7S/lg4bBKxEEEXTcSLlhmDZxMrg=; b=tjrRCsz55541tO n4sOlyJ2ElCntr2xTTXBj0wZT6rfS9WKsQogq9j4PPszzztyRriHylJDRKpw2FxTANceK156UEMeG jEGkiSlUEKNAgZWDCnN5l9w2HlvEtT0GnKORtGcCZoIPKeL4BtktcTXp/qEYN7Vovwp81Ub9YrbG0 V15f4Sykzh7TxBZdXhPeOrUFKSJvLhqX0ybZWWXAg9kTqpW4zef0eD62dyPFPXcC1UtiOYsYTFHg/ VE9lQC0FcNYV+jiqgZrxCkJWA1rYiFhZqhg+ePLLvTIDmN0CNjulCKEuyTfYS0E/1+BZ/wKVFj08k 3H9F4/flxo7SMS6MO6Vw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmyxc-001prn-AF; Tue, 16 Nov 2021 13:57:20 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmyxW-001pr1-3O; Tue, 16 Nov 2021 13:57:17 +0000 X-UUID: 651c4597ce234c9da81c20977e47723a-20211116 X-UUID: 651c4597ce234c9da81c20977e47723a-20211116 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 989367316; Tue, 16 Nov 2021 06:57:06 -0700 Received: from mtkmbs10n2.mediatek.inc (172.21.101.183) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 16 Nov 2021 05:57:04 -0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.3; Tue, 16 Nov 2021 21:57:03 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 16 Nov 2021 21:57:03 +0800 From: Mark-PK Tsai To: CC: , , , , , , , , Subject: Re: [PATCH v2] remoteproc: use %pe format string to print return error code Date: Tue, 16 Nov 2021 21:57:03 +0800 Message-ID: <20211116135703.19432-1-mark-pk.tsai@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211116_055714_176410_98F57781 X-CRM114-Status: GOOD ( 25.81 ) 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 > > > > 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/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel