mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* drivers/gpu/drm/bridge/fsl-ldb.c:101: possible loss of information.
@ 2023-03-07 16:45 David Binderman
  2023-03-08 23:22 ` Laurent Pinchart
  0 siblings, 1 reply; 6+ messages in thread
From: David Binderman @ 2023-03-07 16:45 UTC (permalink / raw)
  To: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
	jernej.skrabec, airlied, daniel, dri-devel, linux-kernel

Hello there,

I just ran the static analyser "cppcheck" over the source code of linux-6.2-rc1. It said:

linux-6.3-rc1/drivers/gpu/drm/bridge/fsl-ldb.c:101:3: style: int result is returned as long value. If the return value is long to avoid loss of information, then you have loss of information. [truncLongCastReturn]

Source code is

static unsigned long fsl_ldb_link_frequency(struct fsl_ldb *fsl_ldb, int clock)
{
    if (fsl_ldb->lvds_dual_link)
        return clock * 3500;
    else
        return clock * 7000;
}

Depending on the range of the value of clock, maybe unsigned long literals, like 3500UL, should
have been used ?

Regards

David Binderman




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-09 10:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-07 16:45 drivers/gpu/drm/bridge/fsl-ldb.c:101: possible loss of information David Binderman
2023-03-08 23:22 ` Laurent Pinchart
2023-03-09  7:59   ` David Binderman
2023-03-09  9:26     ` Laurent Pinchart
2023-03-09  9:42       ` David Binderman
2023-03-09 10:04         ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®