Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6197953rwl; Wed, 22 Mar 2023 07:42:15 -0700 (PDT) X-Google-Smtp-Source: AK7set+EcscVC9vukK0dYCI7HTLsYIdbvaJDjASxfNbQZV5rT/erHxBq/6IXu+QiliZWSqdwuo/I X-Received: by 2002:aa7:d406:0:b0:500:3a14:82c1 with SMTP id z6-20020aa7d406000000b005003a1482c1mr6050099edq.41.1679496134767; Wed, 22 Mar 2023 07:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679496134; cv=none; d=google.com; s=arc-20160816; b=vmCkL12G6XWHH+iagzJMXJF38qabQq7jPamSSUpzqVDyomz16zD/sI/pfQvMFw7PJ9 QHyEaj/g8QijHzbbLr97K5V4gJWzFqAJfyj8ElmlzF1nt8oEZJo/Zz8lCFDn5hWjNKTz OBsnqI7UzXb8o1KdavMcKqxxCrVUPgaiSrwXOa8XQdVKthAVHfqYkPKvCsXfkW2+iJl8 8Hp2LXCd5/4GVh25IKuzoHBi9Oh9C1w7lxXpUD4JyIykiQ9Sd4Dn+gM/rduY6d2QKA09 yEGBZOg329bAM8gN+m8o+YEmwU5Gj5WSmBQ1JwqK4zhDHbfR9/5r0+GgmwljvCFCXh7Y 4g+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Hj6KVJaUBXCIad4JBKM+InWoEPk5fIMzKsSrMCFlY9k=; b=W6Bgv4NR28tq4bOabnb0AETcDV0cKqFxNlSA9vrzf53ojdJB2uT/QlJbCk9Nbvm/7c tWtJe2DwfL+CV/veXBxevEqKWtAE0g3iPQ8bBvPBtUD+fKh74CysW8os4C75adGXsWnl tRPeErp43nLGOYBztsFyPmAFSb+gLt/0ppRt1GBjkNFCiSEfIUt24ivPabyytF3a27/z +8JHd8GHybxX2/sqHvZ6rbqLbPqYOH+UY11ngQ/ZmKFxj4+c1nsAxESNgM7ETsHBIZNH ZPmcgVIEParyr2FJJ3muraulPOqK8uUN/OyoXwSu3lJGlNsUba0xYDFAAHQHoSWM+FZh T4Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Tx2pAAeG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w3-20020a056402070300b004fbb864a75dsi16431410edx.407.2023.03.22.07.41.50; Wed, 22 Mar 2023 07:42:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Tx2pAAeG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231698AbjCVOjs (ORCPT + 99 others); Wed, 22 Mar 2023 10:39:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231531AbjCVOj0 (ORCPT ); Wed, 22 Mar 2023 10:39:26 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 530D6521ED for ; Wed, 22 Mar 2023 07:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679495965; x=1711031965; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XodOHskzLqB9GOrDUS/F5Kh8Lt/zUFltWrdOozMmc8c=; b=Tx2pAAeGQgygEUDmpnqScbs3EkjrnpC35XNYuL7aMZBU+771JiNo6G0U 2iupDvqhjbsFQ/JWqx8wngkuBQU7LhqkJCDUX9zIOByU3IPN4fyFotEi1 nEpPpSfC2v+SgA3BENqc6EjyJ3SeJAI8tfAthvHCN5/RgTIEH9s6w8KpR 8uKaicf8XtBM1o3uDo6YgBPQL7XcRTTKl1pUykedYy1yFeL5FrraIRkOQ /xeQoLZsKeyGZu1EFTOJAk2kkMRMolOh+LF560pfOLIazAIxQK0qQItCZ xFwtxsFyPKbQCjGnc4Y1Z3IjpZVLOYEZ0YbRI7IP0qXru+kKbzANoXOQQ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327609307" X-IronPort-AV: E=Sophos;i="5.98,282,1673942400"; d="scan'208";a="327609307" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 07:39:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="792579436" X-IronPort-AV: E=Sophos;i="5.98,282,1673942400"; d="scan'208";a="792579436" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 22 Mar 2023 07:39:23 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 03630944; Wed, 22 Mar 2023 16:40:07 +0200 (EET) From: Andy Shevchenko To: Bumwoo Lee , Andy Shevchenko , linux-kernel@vger.kernel.org Cc: MyungJoo Ham , Chanwoo Choi Subject: [PATCH v1 12/14] extcon: Use sizeof(*pointer) instead of sizeof(type) Date: Wed, 22 Mar 2023 16:40:03 +0200 Message-Id: <20230322144005.40368-13-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230322144005.40368-1-andriy.shevchenko@linux.intel.com> References: <20230322144005.40368-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is preferred to use sizeof(*pointer) instead of sizeof(type). The type of the variable can change and one needs not change the former (unlike the latter). No functional change intended. Signed-off-by: Andy Shevchenko --- drivers/extcon/extcon.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 0e04ea185c26..b3f038639cd6 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -1099,9 +1099,7 @@ static int extcon_alloc_cables(struct extcon_dev *edev) if (!edev->max_supported) return 0; - edev->cables = kcalloc(edev->max_supported, - sizeof(struct extcon_cable), - GFP_KERNEL); + edev->cables = kcalloc(edev->max_supported, sizeof(*edev->cables), GFP_KERNEL); if (!edev->cables) return -ENOMEM; @@ -1160,14 +1158,12 @@ static int extcon_alloc_muex(struct extcon_dev *edev) for (index = 0; edev->mutually_exclusive[index]; index++) ; - edev->attrs_muex = kcalloc(index + 1, - sizeof(struct attribute *), + edev->attrs_muex = kcalloc(index + 1, sizeof(*edev->attrs_muex), GFP_KERNEL); if (!edev->attrs_muex) return -ENOMEM; - edev->d_attrs_muex = kcalloc(index, - sizeof(struct device_attribute), + edev->d_attrs_muex = kcalloc(index, sizeof(*edev->d_attrs_muex), GFP_KERNEL); if (!edev->d_attrs_muex) { kfree(edev->attrs_muex); @@ -1213,8 +1209,8 @@ static int extcon_alloc_groups(struct extcon_dev *edev) return 0; edev->extcon_dev_type.groups = kcalloc(edev->max_supported + 2, - sizeof(struct attribute_group *), - GFP_KERNEL); + sizeof(*edev->extcon_dev_type.groups), + GFP_KERNEL); if (!edev->extcon_dev_type.groups) return -ENOMEM; @@ -1298,8 +1294,7 @@ int extcon_dev_register(struct extcon_dev *edev) spin_lock_init(&edev->lock); if (edev->max_supported) { - edev->nh = kcalloc(edev->max_supported, sizeof(*edev->nh), - GFP_KERNEL); + edev->nh = kcalloc(edev->max_supported, sizeof(*edev->nh), GFP_KERNEL); if (!edev->nh) { ret = -ENOMEM; goto err_alloc_nh; -- 2.40.0.1.gaa8946217a0b