From patchwork Mon Oct 7 15:06:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13824918 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8C412CFB449 for ; Mon, 7 Oct 2024 15:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=N8Di9psVjG9pwzFvbHumRqIo93Ys2adbFlF/RnbTEvk=; b=bmj2eeVgKcbw6AWEPld1nlfS9c uibvpbuRXLJCtPbyrpTJ/MccYmqQf+dZSHXnvmCKqhHI7iZjm4+SlvD6PZnwhY0bH6rHCWMHyIQrM y3oPYq/oX4kyv6nLY31VsQCrt7xTSdV6LbvSrehV92n32GrF7yDaEALk4QzDMnQm7kyKrB4Hqiouy 3Z5fWJitvaiZ/mLLVB/nR4AXJ3uW1A31rr0IFzuBzI/Te6yB8JFxvgF/y1aOGv/4zGowvKDa4frWe 6ivAAoNEOhIGZycj5pcB1kN3kOxC2IVYEZDRyOX3O7IkIetuS+w8Nd493nAF6N0PBIAaWJsw8V5bf omg4xY8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sxpdb-00000002vrq-2tz0; Mon, 07 Oct 2024 15:27:07 +0000 Received: from mgamail.intel.com ([192.198.163.7]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sxpM3-00000002sYo-2xdx for linux-arm-kernel@lists.infradead.org; Mon, 07 Oct 2024 15:09:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728313740; x=1759849740; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qGhUu9mdJXXubW4rlkY8zXABwAVgp9j7AomaOvWbYPc=; b=cg8/OFAf4RwKM1lGm7wfIVdx1AdA2DDPbQUEv5Ky3fRn+2Ibt91e0T34 1eUBX0SK4+Pau5C0mJIWWReiEXmT2QHq1qX6wjRRPoQ1LUn31wLAKFnKt 9jrbHVRmubLXa/tUGJAE7nW3mNDkxEqM6TREDEacYH67hj/WsqpE4AyaA zv5PdSfV1mL0GSegyl5+R3cJEY7DAxhLwYWYZz/MspKaufDjrgrbFpM7+ aPRnWcOg136TtCLBHNvDqZPsyT81XIohTq38jbIv7nMReZWK0m1JV0tln qEFaGVo+VmaMG0whStW6MX6ikTHhfeyjMeOjfVKZGNPjn8mfRbKpTa1aF g==; X-CSE-ConnectionGUID: oqEo9FVuQ46fylmOkseKAA== X-CSE-MsgGUID: jUdDGJNJR2aagy2+hJUxJQ== X-IronPort-AV: E=McAfee;i="6700,10204,11218"; a="52870238" X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="52870238" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2024 08:08:58 -0700 X-CSE-ConnectionGUID: pm590HrVQSGvXKUrqLQhkA== X-CSE-MsgGUID: vHncrqsZQFCU65LpdBLbvQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="80477332" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 07 Oct 2024 08:08:55 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DCC564FB; Mon, 07 Oct 2024 18:08:53 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Vinod Koul , Paul Cercueil , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Subject: [PATCH v1 3/4] dmaengine: Add a comment on why it's okay when kasprintf() fails Date: Mon, 7 Oct 2024 18:06:47 +0300 Message-ID: <20241007150852.2183722-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241007150852.2183722-1-andriy.shevchenko@linux.intel.com> References: <20241007150852.2183722-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241007_080859_810596_5E09FC3B X-CRM114-Status: GOOD ( 11.44 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In dma_request_chan() one of the kasprintf() call is not checked against NULL. This is completely fine right now, but make others aware of this aspect by adding a comment. Signed-off-by: Andy Shevchenko --- drivers/dma/dmaengine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index c1357d7f3dc6..dd4224d90f07 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c @@ -854,8 +854,8 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name) found: #ifdef CONFIG_DEBUG_FS - chan->dbg_client_name = kasprintf(GFP_KERNEL, "%s:%s", dev_name(dev), - name); + chan->dbg_client_name = kasprintf(GFP_KERNEL, "%s:%s", dev_name(dev), name); + /* No functional issue if it fails, users are supposed to test before use */ #endif chan->name = kasprintf(GFP_KERNEL, "dma:%s", name);