Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1997151imm; Tue, 10 Jul 2018 11:17:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc0T09bIzuIaiGKYOa4eKVUHXK4YwQplEkWBL0/hyLwzjQcorSr4YdwdnsaIiE27mPxd/ZT X-Received: by 2002:a65:63cd:: with SMTP id n13-v6mr23502222pgv.185.1531246668317; Tue, 10 Jul 2018 11:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531246668; cv=none; d=google.com; s=arc-20160816; b=o5TT+bdQKGm2vx5L9jn0NshYd0PerlAmop4AM73Pbarl7CdtHiSYo3BMGn1ObBfGaO yLUHzOCbc2/P5ED4fA1uEVi0/stNFgqvNjeVuqcIslUuMnS8X8isa0wflFz0a8T12dLL qbxHZ4s0NG3UgWSaGA/Eo2/O80TSztuaWvsK83/hZ+AQmsCQ+5e32NJg2pCm7l6qtslt aB8NbcxfUKNM4B5amdxf1vLwz2YZDjhCJ/Mc/6OH0Epw7Nyk4W+RPhjNZAOyYBaqOOam c2exXGeJrpY3Gabu78TwN5M7983PUr1TDYHezhbXes7bQ176XF37rClwTnivu86jKLv9 Ll9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=GdzrCn4Nfl9/sGcQI1y6gmlaoYxyIgncQ479LOqnaXY=; b=N73SeeMIAn0nvkB41+CM+izpLnYhbRDkKZVoJnW5A5GTSjziDUZtzY7NVZpdWp3Ve4 rLhlihzmr+lt6NpNKsUIkq0802KGMO/i8y3cDvH5Qi+eqW5qBrRh63w0DC8Bvc3W7xN0 Hcmi5R8WYa+h+gOX0BBLywTjl7V/P+kbUZFkzIOviXhK0h0PgeYKSRx17KrzJoqosQiT IqHWQp+m9Yk1y/y+aFqVnGo3iDEbplYxYIJIRJjTKbAfvGuxBm28siqVtNua/N+zgrPR 4oVhoLM+v9YcPJIUolXmPJUmLPRa3qDy1Hrhh5l8pXOsUgpLPp+8NqeqlkenRFev8UhN AGKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rI65yFxz; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m24-v6si16682021pgl.452.2018.07.10.11.16.58; Tue, 10 Jul 2018 11:17:48 -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=@gmail.com header.s=20161025 header.b=rI65yFxz; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933380AbeGJRQf (ORCPT + 99 others); Tue, 10 Jul 2018 13:16:35 -0400 Received: from mail-ua0-f196.google.com ([209.85.217.196]:37192 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933299AbeGJRQc (ORCPT ); Tue, 10 Jul 2018 13:16:32 -0400 Received: by mail-ua0-f196.google.com with SMTP id u8-v6so14456468uao.4; Tue, 10 Jul 2018 10:16:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GdzrCn4Nfl9/sGcQI1y6gmlaoYxyIgncQ479LOqnaXY=; b=rI65yFxz1eJ3RRBnqGM/f3TEB/x9PmsuPbafT6nr/i3KAKwn236zczfVm9G5k2MHU3 /1YiPis2GKuNiqzBq59Zjqu/uxFSFePFs6Sfux+XpvW8Uk0hZxI9cZorNjizjnQIIo9V qBAwaOyeu3iIKYj4u1AkDnbHGJbpOKUcyHluJBhjVYv1T9HSqPsmsEltT6+5xpOmqfQi FqO4XVbZ9gvF6XNMuq4lGoWNE+LJzIf2HI95yuFghMwA3sRNOp8X95EZKJDSJBGTeHN5 6CZHxnA5VkrMvdAl9TxgYrb3mD6EGtfLsoHwXYfMq8831Jpfq/upXZmaAkLqMxGwusWh VLlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GdzrCn4Nfl9/sGcQI1y6gmlaoYxyIgncQ479LOqnaXY=; b=bhkHtJOCIEwmY6120SCBGrN/V+SDMekoDMEO+SN/ERJE/ItHm1sUItXjTvcg7KzgaG jUx51O/syqP4HIPtR+xas+3bmELORNwatCMpfV4rVrbyQTuSoXAvHf2ltRa3ui9ixAas J6lfmC2+RehQ7qq71PKxsmChuGGPG/BaDuh9lbKJxitmcB8FrkYlSQ33XZzgiB0dctXr pLyrP8Ii63AjtQRqkmbpPUXyGlWruKsfegFqfssgI3ULKaOxZhk1aQbRGbq3JbGTPDrQ HidBEMZjUqHNsjLL1+/6y2OXEEJceOQa8aCmw1aor9TI0Izti3W1bUrH9BNdRbh8y5dY MruA== X-Gm-Message-State: APt69E26TGCFoe4382l4hV42hgzsAznzlPp+bGb8LnSocCkDjhwCWiBy SZ2wdeM5OKEpbPQDMs3NRohGR1NvF2jCgSXYqKU= X-Received: by 2002:a9f:3047:: with SMTP id i7-v6mr17282869uab.189.1531242991708; Tue, 10 Jul 2018 10:16:31 -0700 (PDT) MIME-Version: 1.0 References: <1530503634-32241-1-git-send-email-lizhijian@cn.fujitsu.com> <1530503634-32241-2-git-send-email-lizhijian@cn.fujitsu.com> <1530503634-32241-3-git-send-email-lizhijian@cn.fujitsu.com> <1f24bf06-88cb-8d09-febf-02ff55ec263a@kernel.org> In-Reply-To: <1f24bf06-88cb-8d09-febf-02ff55ec263a@kernel.org> From: Pintu Kumar Date: Tue, 10 Jul 2018 22:46:20 +0530 Message-ID: Subject: Re: [PATCH 2/3] selftests/android: initialize heap_type to avoid compiling warning To: Shuah Khan Cc: lizhijian@cn.fujitsu.com, linux-kselftest@vger.kernel.org, open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 10, 2018 at 8:20 PM Shuah Khan wrote: > > Hi Li Zhijian, > > On 07/01/2018 09:53 PM, Li Zhijian wrote: > > root@vm-lkp-nex04-8G-7 ~/linux-v4.18-rc2/tools/testing/selftests/android# make > > make[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule. > > make[1]: Entering directory '/root/linux-v4.18-rc2/tools/testing/selftests/android/ion' > > gcc -I. -I../../../../../drivers/staging/android/uapi/ -I../../../../../usr/include/ -Wall -O2 -g ionapp_export.c ipcsocket.c ionutils.c -o ionapp_export > > ionapp_export.c: In function 'main': > > ionapp_export.c:91:2: warning: 'heap_type' may be used uninitialized in > > this function [-Wmaybe-uninitialized] > > printf("heap_type: %ld, heap_size: %ld\n", heap_type, heap_size); > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > CC: Shuah Khan > > CC: Pintu Agarwal > > Signed-off-by: Li Zhijian > > --- > > tools/testing/selftests/android/ion/ionapp_export.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/tools/testing/selftests/android/ion/ionapp_export.c b/tools/testing/selftests/android/ion/ionapp_export.c > > index a944e72..e3435c2 100644 > > --- a/tools/testing/selftests/android/ion/ionapp_export.c > > +++ b/tools/testing/selftests/android/ion/ionapp_export.c > > @@ -49,6 +49,7 @@ int main(int argc, char *argv[]) > > return -1; > > } > > > > + heap_type = -1UL; > > Initialize it to one of the valid types. ION_HEAP_TYPE_SYSTEM > is one choice. > Yes, the test requires at least one of the heap type. If you want, you can set it to the default value (0) at the initialization time and not -1. > > > heap_size = 0; > > flags = 0; > > May be we can set the heap_type as 0 here, to avoid those uninitialized warnings. > > @@ -82,6 +83,12 @@ int main(int argc, char *argv[]) > > } > > } > > > > + if (heap_type == -1UL) { > > + printf("heap_type is invalid\n"); > > + print_usage(argc, argv); > > + exit(1); > > + } > > This check isn't necessary. The test requires two arguments, > -i and -s and won't run without either > one of them. heap_type is going to be ION_HEAP_TYPE_SYSTEM or > ION_HEAP_TYPE_SYSTEM_CONTIG at this point. > > Interesting. Looks like this test doesn't cover all ion_heap_types. > Yes, all heap_types were not supported. As per Laura's request I removed it. Other heap_types actually requires explicit declaration of reserved memory or CMA region. If you require other heap_type support then may be you can look into my github version: https://github.com/pintuk/LINUX/tree/master/android/ion > thanks, > -- Shuah