Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAD27C43331 for ; Sun, 29 Mar 2020 13:37:45 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 90E56206DB for ; Sun, 29 Mar 2020 13:37:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xen.org header.i=@xen.org header.b="GqyUGp5y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90E56206DB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jIY7Y-00034n-KI; Sun, 29 Mar 2020 13:37:00 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jIY7X-00034i-Oc for xen-devel@lists.xenproject.org; Sun, 29 Mar 2020 13:36:59 +0000 X-Inumbo-ID: 5d0a398a-71c2-11ea-92cf-bc764e2007e4 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5d0a398a-71c2-11ea-92cf-bc764e2007e4; Sun, 29 Mar 2020 13:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID :Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=A1y5lW2yV7A2r5T7CPvwdA1Rx46AtoezAi0zBGRIk3A=; b=GqyUGp5y5DISZHis2crEVE/Fzg J7iZEqqihW6Lr50+c21SQ7Z1bh+J6S6y1WLKX1NXMFmiXJM08jBDxOEGcl0UGDEgFeDJfhNp3dE0r 2sMgnRKVmur+0+aNfDAb3zV8iHhc9BuRAn/m6pwEWgGNp5DaviUeLZByp9idB+EIlegU=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jIY7T-0003Zk-5i; Sun, 29 Mar 2020 13:36:55 +0000 Received: from 44.142.6.51.dyn.plus.net ([51.6.142.44] helo=debian) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1jIY7S-0001Fa-S0; Sun, 29 Mar 2020 13:36:55 +0000 Date: Sun, 29 Mar 2020 14:36:51 +0100 From: Wei Liu To: Simran Singhal Message-ID: <20200329133651.yra3nesdqrwwgbte@debian> References: <20200329045512.GA28203@simran-Inspiron-5558> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200329045512.GA28203@simran-Inspiron-5558> User-Agent: NeoMutt/20180716 Subject: Re: [Xen-devel] [PATCH v2] xen/x86: Remove unnecessary cast on void pointer X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian , Jan Beulich , Wei Liu , Andrew Cooper , Jun Nakajima , xen-devel@lists.xenproject.org, Roger Pau =?utf-8?B?TW9ubsOp?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On Sun, Mar 29, 2020 at 10:25:12AM +0530, Simran Singhal wrote: > Assignment to a typed pointer is sufficient in C. > No cast is needed. > > Also, changed some u64/u32 to uint64_t/uint32_t. > > Signed-off-by: Simran Singhal > --- > Changes in v2: > - Took the chance to change some uintX to uintX_t. > > xen/arch/x86/acpi/cpufreq/powernow.c | 2 +- > xen/arch/x86/cpu/vpmu.c | 2 +- > xen/arch/x86/hpet.c | 2 +- > xen/arch/x86/hvm/save.c | 2 +- > xen/arch/x86/hvm/vmx/vvmx.c | 12 ++++++------ > 5 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c b/xen/arch/x86/acpi/cpufreq/powernow.c > index 3cf9c6cd05..f620bebc7e 100644 > --- a/xen/arch/x86/acpi/cpufreq/powernow.c > +++ b/xen/arch/x86/acpi/cpufreq/powernow.c > @@ -58,7 +58,7 @@ static void transition_pstate(void *pstate) > > static void update_cpb(void *data) > { > - struct cpufreq_policy *policy = (struct cpufreq_policy *)data; > + struct cpufreq_policy *policy = data; > > if (policy->turbo != CPUFREQ_TURBO_UNSUPPORTED) { > uint64_t msr_content; > diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c > index e50d478d23..1ed39ef03f 100644 > --- a/xen/arch/x86/cpu/vpmu.c > +++ b/xen/arch/x86/cpu/vpmu.c > @@ -337,7 +337,7 @@ void vpmu_do_interrupt(struct cpu_user_regs *regs) > > static void vpmu_save_force(void *arg) > { > - struct vcpu *v = (struct vcpu *)arg; > + struct vcpu *v = arg; > struct vpmu_struct *vpmu = vcpu_vpmu(v); > > if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED) ) > diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c > index 86929b9ba1..c46e7cf4ee 100644 > --- a/xen/arch/x86/hpet.c > +++ b/xen/arch/x86/hpet.c > @@ -215,7 +215,7 @@ again: > static void hpet_interrupt_handler(int irq, void *data, > struct cpu_user_regs *regs) > { > - struct hpet_event_channel *ch = (struct hpet_event_channel *)data; > + struct hpet_event_channel *ch = data; > > this_cpu(irq_count)--; > > diff --git a/xen/arch/x86/hvm/save.c b/xen/arch/x86/hvm/save.c > index 0fc59d3487..a2c56fbc1e 100644 > --- a/xen/arch/x86/hvm/save.c > +++ b/xen/arch/x86/hvm/save.c > @@ -417,7 +417,7 @@ void _hvm_read_entry(struct hvm_domain_context *h, void *dest, > memcpy(dest, &h->data[h->cur], d->length); > > if ( d->length < dest_len ) > - memset((char *)dest + d->length, 0, dest_len - d->length); > + memset(dest + d->length, 0, dest_len - d->length); I believe you shouldn't drop the cast here either because dest is of type void*. Although the calculation in the end is the same (void* considered of size 1), I would still keep the cast such that the semantics is correct. Wei.