Received: by 10.223.176.46 with SMTP id f43csp2805684wra; Mon, 22 Jan 2018 03:48:33 -0800 (PST) X-Google-Smtp-Source: AH8x226cuSc1JU6/ekbVZGUbCygJRPRsh3iB7r24dhThm8uf5SXUJxgl5UTeW+077G6mQ0KujX8k X-Received: by 10.98.93.157 with SMTP id n29mr8347652pfj.195.1516621713213; Mon, 22 Jan 2018 03:48:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516621713; cv=none; d=google.com; s=arc-20160816; b=CmrH8R0Rq7xx2hEf4VngTVPNIGO7Aj31z1os6W3oCpJxxKLJwq8fqFv8Ijv2Jk4IC/ DrBpy+X4wa7xW55mHpuwXQHU7DCkWtDP3f/cjXtUn91X7g+UIJtDKsHlSXJKNKnR9u8e HyQL9j+3owoG68Z1aAOFi6MmzIXf2lqtWAlAT6ux4sDEuJ7ISZGmgNYVelUtj7Ftb2ou yfeGzUxE83y1HP39bVbR+legufmtABOcmokOjmMqqqZKmBFsuPiiQ+yi8SGcEYOhjIfD OcnDb0DfoBHB1gTdIwRYUdow9EcYiWD87mISbdsnd/iAw74ffKLR0y3wtybZKagIvsCq KjfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=Qzn++OqNRUkM5hvO54p15BPn65/k+hKWhU85A6CUBQY=; b=Z61nNKKWJea0WKUl3phv/mv5jdr0wZyMXVWGSO+5wmfBC8KEKHbgefClFhHDHjqI3+ YwViMBNfaWzbKdDyFOnbIjwZLuxcUcRfVEOhweVLxVXbU8uwmQ2j6vbZ0qzIeLMa3+Fw Ee2DDYEsYXfr/fSB4FNz2Ym+J8bdKbaOx7b3FZGnJ5m9X4eaquv93XEXOgp7wM4FOCmE OutQdscee9hp/v/qayQEJgm4uXAtftq6HHzB4cy1c178X3cYgzpNZed77lqqMobjPDNs r58FWkbokE0seYiiUCFUpVCnrbcunYCOQ+PddkbpC8FEIdT0lfTb1KV/KJFAtBpZzscE 2K3g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k68si13880572pgc.16.2018.01.22.03.48.19; Mon, 22 Jan 2018 03:48:33 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751157AbeAVLrW (ORCPT + 99 others); Mon, 22 Jan 2018 06:47:22 -0500 Received: from foss.arm.com ([217.140.101.70]:57684 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751020AbeAVLrU (ORCPT ); Mon, 22 Jan 2018 06:47:20 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A16531529; Mon, 22 Jan 2018 03:47:20 -0800 (PST) Received: from [10.1.210.88] (e110467-lin.cambridge.arm.com [10.1.210.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5F15C3F53D; Mon, 22 Jan 2018 03:47:19 -0800 (PST) Subject: Re: [PATCH] ARM-SMMU: Delete error messages for a failed memory allocation in three functions To: SF Markus Elfring , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, =?UTF-8?B?SsO2cmcgUsO2ZGVs?= , Will Deacon Cc: LKML , kernel-janitors@vger.kernel.org References: From: Robin Murphy Message-ID: Date: Mon, 22 Jan 2018 11:47:13 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/01/18 14:36, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sat, 20 Jan 2018 15:30:17 +0100 > > Omit extra messages for a memory allocation failure in these functions. Why? It's your job as patch author to convince reviewers and maintainers why your change is a good thing and they should spend their time looking at it, much less consider merging it. This may as well be "delete some stuff because I feel like it". Do bear in mind the nature of these drivers; Arm SMMUs are not something you find in microcontrollers. On systems using these drivers, it will make no difference whatsoever to anyone if the many-megabyte kernel image is 47 bytes (or whatever) smaller. > This issue was detected by using the Coccinelle software. I think I'm going to have to start treating mention of Coccinelle as a potential disclaimer saying "I haven't attempted to understand the code I'm changing" :( > Signed-off-by: Markus Elfring > --- > drivers/iommu/arm-smmu-v3.c | 9 +++------ > drivers/iommu/arm-smmu.c | 9 +++------ > 2 files changed, 6 insertions(+), 12 deletions(-) > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > index f122071688fd..5c2a7103d494 100644 > --- a/drivers/iommu/arm-smmu-v3.c > +++ b/drivers/iommu/arm-smmu-v3.c > @@ -2134,10 +2134,8 @@ static int arm_smmu_init_l1_strtab(struct arm_smmu_device *smmu) > void *strtab = smmu->strtab_cfg.strtab; > > cfg->l1_desc = devm_kzalloc(smmu->dev, size, GFP_KERNEL); > - if (!cfg->l1_desc) { > - dev_err(smmu->dev, "failed to allocate l1 stream table desc\n"); OK, I'll stop playing *completely* dumb; I do know you would get a splat if kmalloc() ever did fail. But what you're removing isn't printk("failed to allocate memory\n"), it's a message which says exactly what allocation failed *for which device*. Can you clarify how I'm going to diagnose this particular problem from the generic splat when all I have is en email from a customer with a dmesg dump? > + if (!cfg->l1_desc) > return -ENOMEM; > - } > > for (i = 0; i < cfg->num_l1_ents; ++i) { > arm_smmu_write_strtab_l1_desc(strtab, &cfg->l1_desc[i]); > @@ -2828,10 +2826,9 @@ static int arm_smmu_device_probe(struct platform_device *pdev) > bool bypass; > > smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL); > - if (!smmu) { > - dev_err(dev, "failed to allocate arm_smmu_device\n"); > + if (!smmu) > return -ENOMEM; > - } > + > smmu->dev = dev; > > if (dev->of_node) { > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index 78d4c6b8f1ba..a4da4a870a2e 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -2048,10 +2048,9 @@ static int arm_smmu_device_probe(struct platform_device *pdev) > int num_irqs, i, err; > > smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL); > - if (!smmu) { > - dev_err(dev, "failed to allocate arm_smmu_device\n"); > + if (!smmu) > return -ENOMEM; > - } > + > smmu->dev = dev; > > if (dev->of_node) > @@ -2084,10 +2083,8 @@ static int arm_smmu_device_probe(struct platform_device *pdev) > > smmu->irqs = devm_kzalloc(dev, sizeof(*smmu->irqs) * num_irqs, > GFP_KERNEL); > - if (!smmu->irqs) { > - dev_err(dev, "failed to allocate %d irqs\n", num_irqs); This more than any other is removing potentially useful information: "failed to allocate 37890756 irqs", for instance, would indicate a bug which is very much *not* an out-of-memory condition. Robin. > + if (!smmu->irqs) > return -ENOMEM; > - } > > for (i = 0; i < num_irqs; ++i) { > int irq = platform_get_irq(pdev, i); >