From patchwork Thu Jan 5 16:07:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 90085 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp9218215qgi; Thu, 5 Jan 2017 16:15:03 -0800 (PST) X-Received: by 10.99.130.66 with SMTP id w63mr17597445pgd.114.1483661703845; Thu, 05 Jan 2017 16:15:03 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n17si77451781pgj.73.2017.01.05.16.15.03; Thu, 05 Jan 2017 16:15:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034664AbdAFAO5 (ORCPT + 25 others); Thu, 5 Jan 2017 19:14:57 -0500 Received: from mail-pf0-f171.google.com ([209.85.192.171]:36733 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034629AbdAFAOg (ORCPT ); Thu, 5 Jan 2017 19:14:36 -0500 Received: by mail-pf0-f171.google.com with SMTP id 189so89970408pfz.3 for ; Thu, 05 Jan 2017 16:14:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=g4mkVvYLu53VIsn0UO7LMllfjesb4CR4F1RFaBVRk/w=; b=RdKI7bBWnrdQP4UsGVgrK9cYXO2hVH7IxcWk50tf5sizjr3aBqKVIWQ6yATdD7aQ0u mQzKyQaGTVM6MlyUXhr3Xe8ijkMrD/RvzAbr9mAjko+0B+2o5AqUWwCwWD+ijLKPdf1u 350mkV3xB7b4KjLJ1P1aEIRhY2ZrfS5hpzMP0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=g4mkVvYLu53VIsn0UO7LMllfjesb4CR4F1RFaBVRk/w=; b=HjIJnlsx1o4UtwpJRkI6seOBFvkS58bafJZXdDhhKTo45e5oqKTlji+vpZ4I44soCK 1lZJkSQSFYtP3FGVc4+aA8ot6cNXoZ3utoUu8w4pvsiJqqkJVEULvQLY9bgP6lHoPk9F 9QSvC/au/uMJeL4O6N+5v6RMmp+GQXE7XN81sBE8mWnaw0Vj5xjRN3j5gFPUR/mrTxEo +3HnIAtEZZ2abIisYidfMJONFAlQhV5k/wP0KvNznmbKCo+D1X3PWgV7oB9VI+ehgsxG luv9cQR+aiLTJTDqFkO80ySHa15HIt6bg7j5BBVc9Qp/s1dDrw0wGT8qrE0flpFwmx55 aXtA== X-Gm-Message-State: AIkVDXJqVB2eWhoAelKppJeaQG9ZmDw5ULXKHl00dYLZqtbbYvaVSggB5NlCVGpTMcDsCh0J X-Received: by 10.99.177.73 with SMTP id g9mr137595971pgp.32.1483661249004; Thu, 05 Jan 2017 16:07:29 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id q27sm155807209pfd.49.2017.01.05.16.07.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jan 2017 16:07:27 -0800 (PST) From: Bjorn Andersson To: Linus Walleij Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] pinctrl: Drop error prints on kzalloc() failure Date: Thu, 5 Jan 2017 08:07:55 -0800 Message-Id: <20170105160755.29254-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Upon failing kzalloc() will print an error message in the log, so there's no need for additional printouts. Also standardizes the "!ptr" vs "ptr == NULL" while I'm touching those lines. Signed-off-by: Bjorn Andersson --- Hope you don't find this too OCD-ish. drivers/pinctrl/core.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) -- 2.11.0 diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index d311d73852a0..e7fc461f471c 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -237,10 +237,8 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev, } pindesc = kzalloc(sizeof(*pindesc), GFP_KERNEL); - if (pindesc == NULL) { - dev_err(pctldev->dev, "failed to alloc struct pin_desc\n"); + if (!pindesc) return -ENOMEM; - } /* Set owner */ pindesc->pctldev = pctldev; @@ -882,11 +880,8 @@ static struct pinctrl_state *create_state(struct pinctrl *p, struct pinctrl_state *state; state = kzalloc(sizeof(*state), GFP_KERNEL); - if (state == NULL) { - dev_err(p->dev, - "failed to alloc struct pinctrl_state\n"); + if (!state) return ERR_PTR(-ENOMEM); - } state->name = name; INIT_LIST_HEAD(&state->settings); @@ -913,11 +908,8 @@ static int add_setting(struct pinctrl *p, struct pinctrl_dev *pctldev, return 0; setting = kzalloc(sizeof(*setting), GFP_KERNEL); - if (setting == NULL) { - dev_err(p->dev, - "failed to alloc struct pinctrl_setting\n"); + if (!setting) return -ENOMEM; - } setting->type = map->type; @@ -997,10 +989,8 @@ static struct pinctrl *create_pinctrl(struct device *dev, * a pin control handle with pinctrl_get() */ p = kzalloc(sizeof(*p), GFP_KERNEL); - if (p == NULL) { - dev_err(dev, "failed to alloc struct pinctrl\n"); + if (!p) return ERR_PTR(-ENOMEM); - } p->dev = dev; INIT_LIST_HEAD(&p->states); INIT_LIST_HEAD(&p->dt_maps); @@ -1357,10 +1347,8 @@ int pinctrl_register_map(struct pinctrl_map const *maps, unsigned num_maps, } maps_node = kzalloc(sizeof(*maps_node), GFP_KERNEL); - if (!maps_node) { - pr_err("failed to alloc struct pinctrl_maps\n"); + if (!maps_node) return -ENOMEM; - } maps_node->num_maps = num_maps; if (dup) { @@ -1983,10 +1971,8 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, return ERR_PTR(-EINVAL); pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL); - if (pctldev == NULL) { - dev_err(dev, "failed to alloc struct pinctrl_dev\n"); + if (!pctldev) return ERR_PTR(-ENOMEM); - } /* Initialize pin control device struct */ pctldev->owner = pctldesc->owner;