[PATCH v8 2/3] media: imx: add a driver for i.MX8MQ mipi csi rx phy and controller

Dan Carpenter dan.carpenter at oracle.com
Mon Jul 26 04:37:11 PDT 2021


On Sat, Jul 24, 2021 at 02:14:08AM +0300, Laurent Pinchart wrote:
> > +static int imx8mq_mipi_csi_calc_hs_settle(struct csi_state *state)
> > +{
> > +	s64 link_freq;
> > +	u32 lane_rate;
> > +	u32 esc_clk_rate = 0;
> 
> This should be an unsigned long.
> 

I have created a Smatch check for this.

regards,
dan carpenter

#include "smatch.h"
#include "smatch_slist.h"

static int my_id;

static void check_type(struct expression *expr, const char *name, struct symbol *sym, void *data)
{
	struct symbol *type = data;
	int bits;

	if (!expr || expr->type != EXPR_ASSIGNMENT)
		return;

	bits = type_bits(get_type(expr->left));
	if (bits >= type_bits(type))
		return;
	sm_msg("wrong type for '%s' (should be '%s')", name, type_to_str(type));
}

void check_clk_get_rate_returns_ul(int id)
{
	my_id = id;

	add_function_param_key_hook("clk_get_rate", &check_type, -1, "$", &ulong_ctype);
}




More information about the linux-arm-kernel mailing list