Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1696713

Sparse warnings on GENMASK + arm32

From Stephen Boyd <sboyd@codeaurora.org>
Newsgroups linux.kernel
Subject Sparse warnings on GENMASK + arm32
Date 2017-07-26 03:40 +0200
Message-ID <u7jsR-29R-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


I see sparse warning when I check a clk driver file in the kernel
on a 32-bit ARM build.

drivers/clk/sunxi/clk-sun6i-ar100.c:65:20: warning: cast truncates bits from constant value (3ffffffff becomes ffffffff)

The code in question looks like:

static const struct factors_data sun6i_ar100_data = {
	.mux = 16,
	.muxmask = GENMASK(1, 0),
	.table = &sun6i_ar100_config,
	.getter = sun6i_get_ar100_factors,
};

where factors_data is

struct factors_data {
	int enable;
	int mux;
	int muxmask;
	const struct clk_factors_config *table;
	void (*getter)(struct factors_request *req);
	void (*recalc)(struct factors_request *req);
	const char *name;
};


and sparse seems to be complaining about the muxmask assignment
here. Oddly, this doesn't happen on arm64 builds. Both times, I'm
checking this on an x86-64 machine.

 $ sparse --version
 v0.5.1-rc4-1-gfa71b7ac0594

Is there something confusing to sparse in the GENMASK macro?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Sparse warnings on GENMASK + arm32 Stephen Boyd <sboyd@codeaurora.org> - 2017-07-26 03:40 +0200
  Re: Sparse warnings on GENMASK + arm32 Lance Richardson <lrichard@redhat.com> - 2017-07-26 15:40 +0200
    Re: Sparse warnings on GENMASK + arm32 Christopher Li <sparse@chrisli.org> - 2017-07-26 15:50 +0200
    Re: Sparse warnings on GENMASK + arm32 Luc Van Oostenryck <luc.vanoostenryck@gmail.com> - 2017-07-26 15:50 +0200

csiph-web