Received: by 10.223.176.46 with SMTP id f43csp3060334wra; Mon, 22 Jan 2018 07:49:12 -0800 (PST) X-Google-Smtp-Source: AH8x225y07XQSD8V+O6cDJ2HhSXofHBtWggOAZiE+K0I5TepDnuT7Mlil7DfTumQnVrxbKG4Hf/2 X-Received: by 10.36.224.139 with SMTP id c133mr8937148ith.39.1516636145990; Mon, 22 Jan 2018 07:49:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516636145; cv=none; d=google.com; s=arc-20160816; b=yRjNT83HjDj9IUIiN+wCmwM2d9AJXmyuDgtGBXsThxFhDoQ0V9PmFj2S7QaQmjpy76 O1AKIMUc/NwG5yqwPBxH8zgJlkjqd7VrYW0A44K6lr/8FAzN4NnVCj3An+T2SxU2rT4y nbl1YFcynG9zATIabc5PkKNn7ydZOfh6gYNemw4scsTm3EP+R+hVL9bBixRAwVtn/0AK cKBp3cMl5hJaHukQMIdVkOXNKEnvIIzNExLCZ90I+yMIUkS4S+IhpKi2LJeT1/D6pjcm DWrMZ5IsGuAFHGr5pw/B2fxfpg6emEqvp+oSneNTnHqFw478GGOilBCRQENk4vQ6+IPZ +yDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=2KU/hySaTi0UvA5PuW/DyzYM7kNhGX9IKFk+0Cgz7Q4=; b=vSJy0j4//FFmT4LtdNd3jAJnT13iARt4udUE/i8rud5sp92vCO3H5fpBWQk1x+FrCl ESKRda/SLNOShx5AVXKAv4QlsSFV8ifbGRViU6AttDfXDraorHv+EurZG5LAcqUUK5gm SNcgYlAa71mlQcnEiZKf+pVGydLjEFxzupkTD7bEh18y2GDDtzXvEUPMHfgEXVAtFmH6 q+WFx3kIPlXGvGq9mBaYC3rcIIbZbSgjIfBwlli/7xgh0MHAzwdZhtZpF4viKRP3hY8b dCZs4GK8IRynfGssZe62W8gB2zq8pPPb0xMbwg8CXF0PdBSXHKRQ4BgTpMYhm8nDpEAT ouig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WDtoYtCk; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n18si11179888ioc.336.2018.01.22.07.48.53; Mon, 22 Jan 2018 07:49:05 -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 header.s=google header.b=WDtoYtCk; 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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751224AbeAVPrk (ORCPT + 99 others); Mon, 22 Jan 2018 10:47:40 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:41894 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751147AbeAVPrh (ORCPT ); Mon, 22 Jan 2018 10:47:37 -0500 Received: by mail-wr0-f195.google.com with SMTP id v15so6339446wrb.8 for ; Mon, 22 Jan 2018 07:47:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=2KU/hySaTi0UvA5PuW/DyzYM7kNhGX9IKFk+0Cgz7Q4=; b=WDtoYtCkzdRvjH8nVKG8gFXDEfzpgYgjE2bxL65R/lJ+eXPC0Wt+8CWyg0SVLxHNVo CIyWO3iZA9uyFB0t4b4JC9d6OTiBNKmVWTXQt6aqrReYuJznDYzULnWDhDdKlt/8brEg Ou6N0VM/fCPopRTNCfxzEPa2GBrxfU2nejnYs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=2KU/hySaTi0UvA5PuW/DyzYM7kNhGX9IKFk+0Cgz7Q4=; b=CF+o4xtZs4BjVWz612WHMfDy0/e9VgtGvtsQ5qi2hK7OfkNrmOy5Ts2S42hAqoWf5n iyhZUJjU0mbQbgBMgbNRMh6NvUtWupgH78mvp0AuWkY65GdHnN+X9OxevupyJSgii9iv poUlDRv1wRHB6qTJ5CmNCTkiF2W97qy+L0w92fouz4T6T1wykHEvfRzm2ux+y+AkhjUw K/oz7LQLI2EWOunixTqlkD9p9pUYGqsrnR1lZAi4s2ffyneCncMf+iDfXzKahsFe7ZoY l2VXxbHZzbkaiLmcxIQyQOWoRHPz8XkdPHsm0E9FRgKMei89z+Ad42WJWL3zhkHuzYCP Cz8w== X-Gm-Message-State: AKwxyteWTUsY/ldmWnYcucb69V9t9JD780i4CiLAbfKUfiEn8JtE95c/ iFezn6CmCorEEZGkFzhq5zulcRDQNbw= X-Received: by 10.223.176.39 with SMTP id f36mr6443280wra.113.1516636055920; Mon, 22 Jan 2018 07:47:35 -0800 (PST) Received: from dell ([2.27.167.60]) by smtp.gmail.com with ESMTPSA id c143sm7236083wmd.48.2018.01.22.07.47.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jan 2018 07:47:35 -0800 (PST) Date: Mon, 22 Jan 2018 15:47:33 +0000 From: Lee Jones To: SF Markus Elfring Cc: kernel-janitors@vger.kernel.org, LKML Subject: Re: [PATCH 2/3] mfd/sm501: Improve a size determination in two functions Message-ID: <20180122154733.zpqfqryoyrwo63s2@dell> References: <3b264527-b43f-b6aa-0570-c6d48ed24679@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3b264527-b43f-b6aa-0570-c6d48ed24679@users.sourceforge.net> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 15 Jan 2018, SF Markus Elfring wrote: > From: Markus Elfring > Date: Mon, 15 Jan 2018 15:47:03 +0100 > > Replace the specification of data structures by pointer dereferences > as the parameter for the operator "sizeof" to make the corresponding size > determination a bit safer according to the Linux coding style convention. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring > --- > drivers/mfd/sm501.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c > index 7298d6b571a1..d5ab3481794a 100644 > --- a/drivers/mfd/sm501.c > +++ b/drivers/mfd/sm501.c > @@ -1380,10 +1380,9 @@ static int sm501_init_dev(struct sm501_devdata *sm) > > static int sm501_plat_probe(struct platform_device *dev) > { > - struct sm501_devdata *sm; > int ret; > + struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL); > > - sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL); Leave this here please. Just s/struct sm501_devdata/*sm/ > if (sm == NULL) { > ret = -ENOMEM; > goto err1; > @@ -1569,10 +1568,9 @@ static struct sm501_platdata sm501_pci_platdata = { > static int sm501_pci_probe(struct pci_dev *dev, > const struct pci_device_id *id) > { > - struct sm501_devdata *sm; > int err; > + struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL); > > - sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL); As above. > if (sm == NULL) { > err = -ENOMEM; > goto err1; -- Lee Jones Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog