From patchwork Wed Aug 6 12:59:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 4685781 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 88B569F373 for ; Wed, 6 Aug 2014 12:59:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C914D2010C for ; Wed, 6 Aug 2014 12:59:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB7D6200ED for ; Wed, 6 Aug 2014 12:59:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756116AbaHFM7b (ORCPT ); Wed, 6 Aug 2014 08:59:31 -0400 Received: from michel.telenet-ops.be ([195.130.137.88]:43537 "EHLO michel.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756134AbaHFM70 (ORCPT ); Wed, 6 Aug 2014 08:59:26 -0400 Received: from ayla.of.borg ([84.193.84.167]) by michel.telenet-ops.be with bizsmtp id bQzM1o00g3cczKo06QzMDG; Wed, 06 Aug 2014 14:59:24 +0200 Received: from geert by ayla.of.borg with local (Exim 4.76) (envelope-from ) id 1XF0oL-0001Ux-Jz; Wed, 06 Aug 2014 14:59:21 +0200 From: Geert Uytterhoeven To: Mark Brown , Simon Horman Cc: Laurent Pinchart , linux-spi@vger.kernel.org, linux-sh@vger.kernel.org, dmaengine@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 03/12] spi: rspi: Use devm_kasprintf() Date: Wed, 6 Aug 2014 14:59:00 +0200 Message-Id: <1407329949-5695-4-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1407329949-5695-1-git-send-email-geert+renesas@glider.be> References: <1407329949-5695-1-git-send-email-geert+renesas@glider.be> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use the devm_kasprintf() helper function instead of open coding error-prone buffer handling and string formatting. Signed-off-by: Geert Uytterhoeven --- devm_kasprintf() was included in upstream, and will be available as of release v3.17-rc1. --- drivers/spi/spi-rspi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index a4d8d3cf2912..aa1c6a893570 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c @@ -1046,12 +1046,11 @@ static int rspi_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler, const char *suffix, void *dev_id) { - const char *base = dev_name(dev); - size_t len = strlen(base) + strlen(suffix) + 2; - char *name = devm_kzalloc(dev, len, GFP_KERNEL); + const char *name = devm_kasprintf(dev, GFP_KERNEL, "%s:%s", + dev_name(dev), suffix); if (!name) return -ENOMEM; - snprintf(name, len, "%s:%s", base, suffix); + return devm_request_irq(dev, irq, handler, 0, name, dev_id); }