From patchwork Tue Oct 15 03:07:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1176758 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46sggz5Qfbz9sPJ for ; Tue, 15 Oct 2019 14:21:35 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MIg7+KzA"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46sggz3yH8zDqJK for ; Tue, 15 Oct 2019 14:21:35 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::444; helo=mail-pf1-x444.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MIg7+KzA"; dkim-atps=neutral Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46sgVH0QL2zDqNF for ; Tue, 15 Oct 2019 14:13:11 +1100 (AEDT) Received: by mail-pf1-x444.google.com with SMTP id q12so11500846pff.9 for ; Mon, 14 Oct 2019 20:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9NVkFbub6UN5cMArRCUgvpJUKfvIwW1Pj3T2uigXbSk=; b=MIg7+KzAY2n+Ppt7G0XxrYB9ArgkBNg+VF4CQ6tN+5/f9mdZ70IgKC3HguYP++cVYz VwppzeC/3xGI2y50q4K6TwoG3FYUuYCDzZcu53A+6onB2sFM2YUTcYCjLkNXrC5Ybu4S NtMUDy1jR4suOya0/kDU5l1Y5vtpyzOMiINIK0SAGU4KoDMLObjI0jWxU99vsaCx2yOj NSXhGq0Vdg9FKDYjmnr9h2P4WkSUm1yQ3/ROWJdt9wTJn7ie24rRPSo3rIx0ak1bkOMH ZsTXuudppeutaDmzCJHSfHuqRjpkeudkbHoHZQ22IV4f/B4gFiLKYPjMpKfKV9rAPFyd 2XyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9NVkFbub6UN5cMArRCUgvpJUKfvIwW1Pj3T2uigXbSk=; b=YSTTyM5ug6ThijCA7PH1dotwWte6IdCw6hP2kaR7lEskKGiXDeH45pmJ2d86z2X2++ bk1ytjZKC1XixAQcpXQyqrLuWVCvZl1QFTtTCmA3xG1qifCOQPjz4BCJlWxP3KTnxUCe 2mo2D6eTVon1aEegosNCW3KwTWdmh26oRLIcZ/B507Q5TDVftLx7PY86xOsT84wyF6nM OvhRneEIDDN+zh0JvtqaCZPOewol/D0m8wrA1cS2Ey/UfJbXCf7F2iQoggaT1V+sQow5 JNUKZ5RjNNepQrtvI/FRL4OZfCqYKV/kePQS+0c0iFlvwRpN7tpy/4FzJRepyyeKr4CP zJRg== X-Gm-Message-State: APjAAAWbEWc5nrKNjHyXNIh7hzrAp45F/qkdAGdodWy93VcYccTX0IOO UHy/WkTxRDKOU28LNeSmqx1AbvCv+/o= X-Google-Smtp-Source: APXvYqwTJESQn4jQzZ7R22vxuqQCbAnDRV/ZhPPslJEfrjoaau4E6ZAC6ns4A8vV3nJrS7TiUtUQ7A== X-Received: by 2002:a17:90a:b304:: with SMTP id d4mr40543526pjr.27.1571109187670; Mon, 14 Oct 2019 20:13:07 -0700 (PDT) Received: from bobo.local0.net (60-240-111-58.tpgi.com.au. [60.240.111.58]) by smtp.gmail.com with ESMTPSA id w6sm23089828pfw.84.2019.10.14.20.13.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 20:13:07 -0700 (PDT) From: Nicholas Piggin To: skiboot@lists.ozlabs.org Date: Tue, 15 Oct 2019 13:07:17 +1000 Message-Id: <20191015030717.15637-28-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191015030717.15637-1-npiggin@gmail.com> References: <20191015030717.15637-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Skiboot] [PATCH v5 27/27] Fix simple sparse warnings X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Should be no real code change, these mostly update type declarations that sparse complains about. Signed-off-by: Nicholas Piggin --- core/init.c | 4 ++-- core/pci.c | 2 +- core/platform.c | 2 +- hdata/tpmrel.c | 2 +- hw/fsp/fsp-dpo.c | 2 +- hw/imc.c | 4 ++-- hw/vas.c | 2 +- include/device.h | 3 ++- include/skiboot.h | 2 +- libc/stdlib/labs.c | 2 +- platforms/astbmc/common.c | 4 ++-- platforms/astbmc/p8dtu.c | 2 +- platforms/astbmc/p9dsu.c | 2 +- platforms/astbmc/witherspoon.c | 6 +++--- 14 files changed, 20 insertions(+), 19 deletions(-) diff --git a/core/init.c b/core/init.c index 0b63655bc..8b1c8c511 100644 --- a/core/init.c +++ b/core/init.c @@ -529,7 +529,7 @@ static int64_t cpu_disable_ME_RI_all(void) return OPAL_SUCCESS; } -void *fdt; +static void *fdt; void __noreturn load_and_boot_kernel(bool is_reboot) { @@ -797,7 +797,7 @@ static void setup_branch_null_catcher(void) * ABI v1 (ie. big endian). This will be broken if we ever * move to ABI v2 (ie little endian) */ - memcpy_null(0, bn, 16); + memcpy_null((void *)0, bn, 16); } #endif diff --git a/core/pci.c b/core/pci.c index 4d0671661..59b395919 100644 --- a/core/pci.c +++ b/core/pci.c @@ -1371,7 +1371,7 @@ void pci_std_swizzle_irq_map(struct dt_node *np, dt_add_property_cells(np, "interrupt-map-mask", 0xf800, 0, 0, 7); } - map_size = esize * edevcount * 4 * sizeof(uint32_t); + map_size = esize * edevcount * 4 * sizeof(u32); map = p = zalloc(map_size); if (!map) { prerror("Failed to allocate interrupt-map-mask !\n"); diff --git a/core/platform.c b/core/platform.c index 9f1873c90..2544f0ccf 100644 --- a/core/platform.c +++ b/core/platform.c @@ -184,7 +184,7 @@ static int generic_start_preload_resource(enum resource_id id, uint32_t subid, } /* These values will work for a ZZ booted using BML */ -const struct platform_ocapi generic_ocapi = { +static const struct platform_ocapi generic_ocapi = { .i2c_engine = 1, .i2c_port = 4, .i2c_reset_addr = 0x20, diff --git a/hdata/tpmrel.c b/hdata/tpmrel.c index 1fe14c75e..9796fc732 100644 --- a/hdata/tpmrel.c +++ b/hdata/tpmrel.c @@ -118,7 +118,7 @@ static struct dt_node *get_hb_reserved_memory(const char *label) return NULL; } -struct { +static struct { uint32_t type; const char *compat; } cvc_services[] = { diff --git a/hw/fsp/fsp-dpo.c b/hw/fsp/fsp-dpo.c index 0796d9ae9..1f7bacf04 100644 --- a/hw/fsp/fsp-dpo.c +++ b/hw/fsp/fsp-dpo.c @@ -18,7 +18,7 @@ #define DPO_CMD_SGN_BYTE1 0x20 /* Byte[1] signature */ #define DPO_TIMEOUT 2700 /* 45 minutes in seconds */ -bool fsp_dpo_pending; +static bool fsp_dpo_pending; static unsigned long fsp_dpo_init_tb; /* diff --git a/hw/imc.c b/hw/imc.c index 36c2cf3a5..3a5382c0c 100644 --- a/hw/imc.c +++ b/hw/imc.c @@ -455,8 +455,8 @@ static void imc_dt_update_nest_node(struct dt_node *dev) const struct dt_property *type; /* Add the base_addr and chip-id properties for the nest node */ - base_addr = malloc(sizeof(uint64_t) * nr_chip); - chipids = malloc(sizeof(uint32_t) * nr_chip); + base_addr = malloc(sizeof(u64) * nr_chip); + chipids = malloc(sizeof(u32) * nr_chip); for_each_chip(chip) { base_addr[i] = cpu_to_be64(chip->homer_base); chipids[i] = cpu_to_be32(chip->id); diff --git a/hw/vas.c b/hw/vas.c index 82a07904c..3303a12fe 100644 --- a/hw/vas.c +++ b/hw/vas.c @@ -457,7 +457,7 @@ static int init_vas_inst(struct dt_node *np, bool enable) } -void vas_init() +void vas_init(void) { bool enabled; struct dt_node *np; diff --git a/include/device.h b/include/device.h index 4f7a0983f..f17b089d8 100644 --- a/include/device.h +++ b/include/device.h @@ -118,7 +118,8 @@ struct dt_property *__dt_add_property_u64s(struct dt_node *node, static inline struct dt_property *dt_add_property_u64(struct dt_node *node, const char *name, u64 val) { - return dt_add_property_cells(node, name, (u32)(val >> 32), (u32)val); + return dt_add_property_cells(node, name, (u32)(val >> 32), + (u32)(val & 0xffffffffUL)); } void dt_del_property(struct dt_node *node, struct dt_property *prop); diff --git a/include/skiboot.h b/include/skiboot.h index 686ba9dc8..4280f28ae 100644 --- a/include/skiboot.h +++ b/include/skiboot.h @@ -318,7 +318,7 @@ extern void fake_rtc_init(void); struct stack_frame; extern void exception_entry(struct stack_frame *stack); extern void exception_entry_pm_sreset(void); -extern void exception_entry_pm_mce(void); +extern void __noreturn exception_entry_pm_mce(void); /* Assembly in head.S */ extern void disable_machine_check(void); diff --git a/libc/stdlib/labs.c b/libc/stdlib/labs.c index 9b68bb275..8bd15eab9 100644 --- a/libc/stdlib/labs.c +++ b/libc/stdlib/labs.c @@ -19,7 +19,7 @@ * Returns the absolute value of the long integer argument */ -long int labs(long int n) +long int __attribute__((const)) labs(long int n) { return (n > 0) ? n : -n; } diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c index 15ac231fb..de837f326 100644 --- a/platforms/astbmc/common.c +++ b/platforms/astbmc/common.c @@ -503,13 +503,13 @@ void astbmc_exit(void) ipmi_wdt_final_reset(); } -const struct bmc_sw_config bmc_sw_ami = { +static const struct bmc_sw_config bmc_sw_ami = { .ipmi_oem_partial_add_esel = IPMI_CODE(0x3a, 0xf0), .ipmi_oem_pnor_access_status = IPMI_CODE(0x3a, 0x07), .ipmi_oem_hiomap_cmd = IPMI_CODE(0x3a, 0x5a), }; -const struct bmc_sw_config bmc_sw_openbmc = { +static const struct bmc_sw_config bmc_sw_openbmc = { .ipmi_oem_partial_add_esel = IPMI_CODE(0x3a, 0xf0), .ipmi_oem_hiomap_cmd = IPMI_CODE(0x3a, 0x5a), }; diff --git a/platforms/astbmc/p8dtu.c b/platforms/astbmc/p8dtu.c index c62223b24..a9d8dc068 100644 --- a/platforms/astbmc/p8dtu.c +++ b/platforms/astbmc/p8dtu.c @@ -223,7 +223,7 @@ static const struct bmc_sw_config bmc_sw_smc = { }; /* Provided by Eric Chen (SMC) */ -const struct bmc_hw_config p8dtu_bmc_hw = { +static const struct bmc_hw_config p8dtu_bmc_hw = { .scu_revision_id = 0x02010303, .mcr_configuration = 0x00000577, .mcr_scu_mpll = 0x000050c0, diff --git a/platforms/astbmc/p9dsu.c b/platforms/astbmc/p9dsu.c index d49f7fe07..5c9756ec6 100644 --- a/platforms/astbmc/p9dsu.c +++ b/platforms/astbmc/p9dsu.c @@ -695,7 +695,7 @@ static const struct bmc_sw_config bmc_sw_smc = { }; /* Provided by Eric Chen (SMC) */ -const struct bmc_hw_config p9dsu_bmc_hw = { +static const struct bmc_hw_config p9dsu_bmc_hw = { .scu_revision_id = 0x04030303, .mcr_configuration = 0x11000756, .mcr_scu_mpll = 0x000071c1, diff --git a/platforms/astbmc/witherspoon.c b/platforms/astbmc/witherspoon.c index 8aaed975f..edf84fb89 100644 --- a/platforms/astbmc/witherspoon.c +++ b/platforms/astbmc/witherspoon.c @@ -325,7 +325,7 @@ i2c_failed: return; } -const struct platform_ocapi witherspoon_ocapi = { +static const struct platform_ocapi witherspoon_ocapi = { .i2c_engine = 1, .i2c_port = 4, .odl_phy_swap = false, @@ -370,8 +370,8 @@ static int gpu_slot_to_num(const char *slot) static void npu2_phb_nvlink_dt(struct phb *npuphb) { - struct dt_node *g[3] = { 0 }; /* Current maximum is 3 GPUs per 1 NPU */ - struct dt_node *n[6] = { 0 }; + struct dt_node *g[3] = { NULL }; /* Current maximum 3 GPUs per 1 NPU */ + struct dt_node *n[6] = { NULL }; int max_gpus, i, gpuid, first, last; struct npu2 *npu2_phb = phb_to_npu2_nvlink(npuphb); struct pci_device *npd;