Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp208027imj; Thu, 14 Feb 2019 18:43:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IY3p6KA+z+Ehy4JFXqD/NdDeUamzfgv75wX5vE0/FjH35+FSihPSwnnCEQ2QDHjavPCAgUG X-Received: by 2002:a62:1382:: with SMTP id 2mr3678568pft.157.1550198600974; Thu, 14 Feb 2019 18:43:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198600; cv=none; d=google.com; s=arc-20160816; b=rWz0vMJa1rzrHorPT61qcHDR1cBpbEl3JmY4jMa8EPJ8UUE3pJ/Nl7MIItlQ3fCUyZ wE08BlRNDLsqFxXRco+lsKm05AAuVSlxmfHc482+CI/QsKNf+sKes8EvQSg3AHMpPavE n90MmKxZoX32wgDV6/EA2/xKdXEvkDSHMy8omSbbZv2BLwdo4wUL5USzq9jDS4SY4Yq5 1H/KgDSeBlfttbsZv6GswnvfFB6Rl0hDi/Pa+EKBDl+kDtEOEZveP0fFsMTSclXamcCY AcRj2ysk1bOhr+deUXe+l/jjk0M35Smh1djOAt8rb/TZ2T7jCKbrZRB5bfK8RmOpkce7 oQAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Yjs8r/N4WzLUaumHpesL/KE1BCftsFqexWW/864Txq0=; b=QWzjxqF3KawyQQsbUZiWRVPoORNCvxDO7plpp+H7wRNcqZmf10G+OUazKQ4UJRHLRK vamQGbE5e+708OYFQQxGv7GB7FHTB6NRU+5pgyztXHurenTTGXkQl+Wu9Flob8hoVL7N T7YpOiCx2wfRfVGrWuPxW8d6qIfqfdmSUJMGpZsuqfShiHRg+oKi2F8EYEZgHNtyoo4S YJPDEiBTplkhZNGhvLqJc8bVxtPa/jVdnWHBNJ0pQmrcgwLyr+omayLIQBiT85Qsrl4z bctlGsToqEtWHCRvqFTOQamVPNtKYzmHVs+J81vvFiDMJBehi7IpH9tDIzXi4AhHc86E xSdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TWVc08Of; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7si3893410pgr.149.2019.02.14.18.43.05; Thu, 14 Feb 2019 18:43:20 -0800 (PST) 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=@kernel.org header.s=default header.b=TWVc08Of; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730798AbfBOCkq (ORCPT + 99 others); Thu, 14 Feb 2019 21:40:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:49984 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389306AbfBOCJu (ORCPT ); Thu, 14 Feb 2019 21:09:50 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 51D0A222A1; Fri, 15 Feb 2019 02:09:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550196590; bh=sHOffNftr5cojCLr4zTtyl8CXbnnKArh2igKxuogNS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TWVc08OfnDuScZCAqdE4TZkRJxJlNazLaFr3VkED658wT0+D0GwuZhfH53HO63bGB /FZsPqVW4xG+0QXks9hDY4I5GvCHid7gMBUFT6YS5F/Ig2ylzhB2aHIEPP/m1ewlPu +rWvCOggczcXRDCpLF4U439ABZYTQAA3UUOHm+Ok= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Eugeniy Paltsev , Vineet Gupta , Sasha Levin , linux-snps-arc@lists.infradead.org Subject: [PATCH AUTOSEL 4.20 32/77] ARC: fix __ffs return value to avoid build warnings Date: Thu, 14 Feb 2019 21:08:10 -0500 Message-Id: <20190215020855.176727-32-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215020855.176727-1-sashal@kernel.org> References: <20190215020855.176727-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eugeniy Paltsev [ Upstream commit 4e868f8419cb4cb558c5d428e7ab5629cef864c7 ] | CC mm/nobootmem.o |In file included from ./include/asm-generic/bug.h:18:0, | from ./arch/arc/include/asm/bug.h:32, | from ./include/linux/bug.h:5, | from ./include/linux/mmdebug.h:5, | from ./include/linux/gfp.h:5, | from ./include/linux/slab.h:15, | from mm/nobootmem.c:14: |mm/nobootmem.c: In function '__free_pages_memory': |./include/linux/kernel.h:845:29: warning: comparison of distinct pointer types lacks a cast | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) | ^ |./include/linux/kernel.h:859:4: note: in expansion of macro '__typecheck' | (__typecheck(x, y) && __no_side_effects(x, y)) | ^~~~~~~~~~~ |./include/linux/kernel.h:869:24: note: in expansion of macro '__safe_cmp' | __builtin_choose_expr(__safe_cmp(x, y), \ | ^~~~~~~~~~ |./include/linux/kernel.h:878:19: note: in expansion of macro '__careful_cmp' | #define min(x, y) __careful_cmp(x, y, <) | ^~~~~~~~~~~~~ |mm/nobootmem.c:104:11: note: in expansion of macro 'min' | order = min(MAX_ORDER - 1UL, __ffs(start)); Change __ffs return value from 'int' to 'unsigned long' as it is done in other implementations (like asm-generic, x86, etc...) to avoid build-time warnings in places where type is strictly checked. As __ffs may return values in [0-31] interval changing return type to unsigned is valid. Signed-off-by: Eugeniy Paltsev Signed-off-by: Vineet Gupta Signed-off-by: Sasha Levin --- arch/arc/include/asm/bitops.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arc/include/asm/bitops.h b/arch/arc/include/asm/bitops.h index 8da87feec59a..99e6d8948f4a 100644 --- a/arch/arc/include/asm/bitops.h +++ b/arch/arc/include/asm/bitops.h @@ -340,7 +340,7 @@ static inline __attribute__ ((const)) int __fls(unsigned long x) /* * __ffs: Similar to ffs, but zero based (0-31) */ -static inline __attribute__ ((const)) int __ffs(unsigned long word) +static inline __attribute__ ((const)) unsigned long __ffs(unsigned long word) { if (!word) return word; @@ -400,9 +400,9 @@ static inline __attribute__ ((const)) int ffs(unsigned long x) /* * __ffs: Similar to ffs, but zero based (0-31) */ -static inline __attribute__ ((const)) int __ffs(unsigned long x) +static inline __attribute__ ((const)) unsigned long __ffs(unsigned long x) { - int n; + unsigned long n; asm volatile( " ffs.f %0, %1 \n" /* 0:31; 31(Z) if src 0 */ -- 2.19.1