mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Angelo Dureghello <angelo@kernel-space.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-can@vger.kernel.org,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: re: can: flexcan: add mcf5441x support
Date: Tue, 3 Aug 2021 16:23:26 +0100	[thread overview]
Message-ID: <7c80c17f-e38a-8fb1-f3c7-987187a2c4d8@canonical.com> (raw)

Hi,

Static analysis of linux-next with Coverity has detected a potential
issue with the following commit:

commit d9cead75b1c66b4660b4f87ff339234042d7c6a5
Author: Angelo Dureghello <angelo@kernel-space.org>
Date:   Fri Jul 2 11:48:41 2021 +0200

    can: flexcan: add mcf5441x support

The analysis is as follows:

650 static int flexcan_clks_enable(const struct flexcan_priv *priv)
651 {

   1. var_decl: Declaring variable err without initializer.

652        int err;
653

   2. Condition priv->clk_ipg, taking false branch.

654        if (priv->clk_ipg) {
655                err = clk_prepare_enable(priv->clk_ipg);
656                if (err)
657                        return err;
658        }
659

   3. Condition priv->clk_per, taking false branch.

660        if (priv->clk_per) {
661                err = clk_prepare_enable(priv->clk_per);
662                if (err)
663                        clk_disable_unprepare(priv->clk_ipg);
664        }
665

   Uninitialized scalar variable (UNINIT)
   4. uninit_use: Using uninitialized value err.

666        return err;
667 }

I'm not sure if it's possible for priv->clk_ipg and priv_clk_per to both
be null, so I'm not sure if err can end up being not set. However, it
does seem that either err should be zero or some err value, but I was
unsure how err should be initialized in this corner case. As it stands,
err probably needs to be set just to be safe.

Colin

             reply	other threads:[~2021-08-03 15:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 15:23 Colin Ian King [this message]
2021-08-04  7:20 ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c80c17f-e38a-8fb1-f3c7-987187a2c4d8@canonical.com \
    --to=colin.king@canonical.com \
    --cc=angelo@kernel-space.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®