From patchwork Sun Feb 21 14:22:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 8368551 Return-Path: X-Original-To: patchwork-platform-driver-x86@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7A917C0553 for ; Sun, 21 Feb 2016 17:31:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA42E2041C for ; Sun, 21 Feb 2016 17:31:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D69502040F for ; Sun, 21 Feb 2016 17:31:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753057AbcBURat (ORCPT ); Sun, 21 Feb 2016 12:30:49 -0500 Received: from sauhun.de ([89.238.76.85]:53469 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753041AbcBURaq (ORCPT ); Sun, 21 Feb 2016 12:30:46 -0500 Received: from p4fe25e23.dip0.t-ipconnect.de ([79.226.94.35]:39868 helo=localhost) by pokefinder.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1aXUuz-0004Q1-5o; Sun, 21 Feb 2016 15:23:25 +0100 From: Wolfram Sang To: platform-driver-x86@vger.kernel.org Cc: Wolfram Sang , Alex Hung , Darren Hart , linux-kernel@vger.kernel.org Subject: [PATCH] intel-hid: allocate correct amount of memory for private struct Date: Sun, 21 Feb 2016 15:22:27 +0100 Message-Id: <1456064574-11245-1-git-send-email-wsa@the-dreams.de> X-Mailer: git-send-email 2.7.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We want the size of the struct, not of a pointer to it. To be future proof, just dereference the pointer to get the desired type. Signed-off-by: Wolfram Sang --- Compile tested only. Found by static code analysis. drivers/platform/x86/intel-hid.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c index e20f23e04c24ce..f93abc8c1424ad 100644 --- a/drivers/platform/x86/intel-hid.c +++ b/drivers/platform/x86/intel-hid.c @@ -180,8 +180,7 @@ static int intel_hid_probe(struct platform_device *device) return -ENODEV; } - priv = devm_kzalloc(&device->dev, - sizeof(struct intel_hid_priv *), GFP_KERNEL); + priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; dev_set_drvdata(&device->dev, priv);