Received: by 2002:a17:90a:37e8:0:0:0:0 with SMTP id v95csp367185pjb; Fri, 4 Oct 2019 00:32:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUxoRX3ji6dE27Gd7NCvorPYSlFUNOxGtq3fa0Twc89/qWGrCRuaAHtAa0xd7fejfu9ACE X-Received: by 2002:a17:906:b742:: with SMTP id fx2mr11126688ejb.205.1570174370032; Fri, 04 Oct 2019 00:32:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570174370; cv=none; d=google.com; s=arc-20160816; b=QJkcNbi5X4ZtbUhmel0Q1/a+D0JQX+rShCjWsKZPIVa5/ansaPFN9uwZMllMKaHbfj N4utK2ToXArx7gW20ahzoLaEBEx6n+lSkpW4gsOGUqhgAr1vCFgISIMoc+spIh6POtzr YvGn8SgvK6wxiEc1ehPuYdKenu4Wsvm7iAInXXoB+GGsWYk7KyTT3V215uwo/nLaZvIv u6V7BeAQGqrADXVYoHlb4AZ9BnC0GNdevwVOLzhBIUajDaMPh31SPky/5Bx6yjWOFLVu iP4gWMEzja5EGvBlyyxgMVrcDF+5pXcpIsTzrTJRfzD1IZKoWTL5aX2Xj8C1mQWwwV6b tb1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:user-agent:subject:cc:to:from :references:in-reply-to:content-transfer-encoding:mime-version :message-id:dkim-signature; bh=TiQAIr9ujj+zBKHfm8KctaRq17mtsGT6UynXcmjKAZc=; b=Y1Aty5PldthCzvaTuGz7nIwJ3sUEK9NuAq27AUQJQQppWMEaVD3YwqoaXOVL5T1TVb WkUY+WFdDsUuWfjjelX+ri1PXHLo/OIxFpf/M+C7360ckmvBeDcLO9E0cV6o+8yakKxj N4UyOXL2idEqe1d5voU9eDpWagu+Q/xLwcseDynizIivsfFxzpcYwEQ/DLBF5DCUuaJx kDgxMv4kd+Cht48MBKf1g1hy73WhVYbo65P0yJglOTx1s147STI7UnfLK6U7+jp5je1T U89m1O5O+xg9aVfEV396UZJwsHU56yGTrsZ3r4yGV12Kh6KIQGDj+xoQBa1dJlGpsCJr h9Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WY4aT7Dq; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2si3042439edb.346.2019.10.04.00.32.25; Fri, 04 Oct 2019 00:32:50 -0700 (PDT) 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=@chromium.org header.s=google header.b=WY4aT7Dq; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731272AbfJCXXE (ORCPT + 99 others); Thu, 3 Oct 2019 19:23:04 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:36881 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727452AbfJCXXE (ORCPT ); Thu, 3 Oct 2019 19:23:04 -0400 Received: by mail-pl1-f196.google.com with SMTP id u20so2228884plq.4 for ; Thu, 03 Oct 2019 16:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=message-id:mime-version:content-transfer-encoding:in-reply-to :references:from:to:cc:subject:user-agent:date; bh=TiQAIr9ujj+zBKHfm8KctaRq17mtsGT6UynXcmjKAZc=; b=WY4aT7DqS6IE6Gh2reTYnoeEJWe4VpS+j3vX3ix0BQe83t331uITUPgiKeEnabROhP Oxc+enz2CsjCq00kr0/IXVwvGVTMdOMfGbfWz0felSjYhJsh0CZJHP2y/C/Cp+kxomU5 8scxJbiIK7o5xWZNYnTTsu4LSc71Ge3BRxvXk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:mime-version :content-transfer-encoding:in-reply-to:references:from:to:cc:subject :user-agent:date; bh=TiQAIr9ujj+zBKHfm8KctaRq17mtsGT6UynXcmjKAZc=; b=taeze6TrZ+UGrlOTXSkumHSgIQE/DoMUjxVZr8+Q76kLSSt3ozhXEXHrq/406/B2NV d0pw988ct3Mo3lM2UI7RTt2mb+910I1soMou02Cwa7cts1oxGED6o42PAhW8jSVeQnf7 XZito4lsqmj2sSSYLiUObSIgRzIiwQDNtOPsyon9omWOHtYdC5S+BBd9Z1Dea9E/3NiG Ba3zWTyQu8sSMQv/8iMHw3Onfs61GOJH213wkwJM610NX4oCvYNAHu91JgRA/yfG2+ch 0fe6kSERyX4gRQzwaq75c+eYTBEod0biZj43HKosNnYL0ifcOWU9h18uaSQms+f1J5ki xvnw== X-Gm-Message-State: APjAAAVqk8qVhwJ1pJ9KIaKFzcdcxh80Myn5N9MWosl8UkQnnvdOUCD9 YgxRdYcbLkDSBX0/2bJ0AS9ssw== X-Received: by 2002:a17:902:b909:: with SMTP id bf9mr12302497plb.60.1570144981888; Thu, 03 Oct 2019 16:23:01 -0700 (PDT) Received: from chromium.org ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id z21sm3847587pfa.119.2019.10.03.16.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2019 16:23:01 -0700 (PDT) Message-ID: <5d9682d5.1c69fb81.4efda.d786@mx.google.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <1570061174-4918-1-git-send-email-mnalajal@codeaurora.org> References: <1570061174-4918-1-git-send-email-mnalajal@codeaurora.org> From: Stephen Boyd To: Murali Nalajala , gregkh@linuxfoundation.org, rafael@kernel.org Cc: mnalajal@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org Subject: Re: [PATCH] base: soc: Handle custom soc information sysfs entries User-Agent: alot/0.8.1 Date: Thu, 03 Oct 2019 16:22:59 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Murali Nalajala (2019-10-02 17:06:14) > @@ -121,6 +118,7 @@ static void soc_release(struct device *dev) > struct soc_device *soc_device_register(struct soc_device_attribute *soc_= dev_attr) > { > struct soc_device *soc_dev; > + const struct attribute_group **soc_attr_groups =3D NULL; Don't initialize this to NULL because it is only tested after it's been unconditionally assigned to the result of the allocation. > int ret; > =20 > if (!soc_bus_type.p) { > @@ -136,10 +134,20 @@ struct soc_device *soc_device_register(struct soc_d= evice_attribute *soc_dev_attr > goto out1; > } > =20 > + soc_attr_groups =3D kzalloc(sizeof(*soc_attr_groups) * Please use kcalloc() instead and drop the define for NUM_ATTR_GROUPS because it's used once. > + NUM_ATTR_GROUPS, GFP_KERN= EL); > + if (!soc_attr_groups) { > + ret =3D -ENOMEM; > + goto out2; > + } > + soc_attr_groups[0] =3D &soc_attr_group; > + soc_attr_groups[1] =3D soc_dev_attr->custom_attr_group; > + soc_attr_groups[2] =3D NULL; Drop this assignment to NULL because kzalloc() and kcalloc() zero out the memory anyway.