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

From: Dan Carpenter
Date: Mon Jul 26 2021 - 07:38:02 EST


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);
}