Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jonathan Lemon <bsd@fb.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Jonathan Lemon <jonathan.lemon@gmail.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"richardcochran@gmail.com" <richardcochran@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH net-next 1/3] ptp: ocp: Fix uninitialized variable warning spotted by clang.
Date: Thu, 12 Aug 2021 22:06:14 +0000	[thread overview]
Message-ID: <09073BD9-9334-494A-802E-4907CF0F0470@fb.com> (raw)
In-Reply-To: <20210812145826.6d795954@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>


> On Aug 12, 2021, at 2:58 PM, Jakub Kicinski <kuba@kernel.org> wrote:
> 
> On Wed, 11 Aug 2021 11:31:31 -0700 Jonathan Lemon wrote:
>> If attempting to flash the firmware with a blob of size 0,
>> the entire write loop is skipped and the uninitialized err
>> is returned.  Fix by setting to 0 first.
>> 
>> Also remove a now-unused error handling statement.
>> 
>> Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
>> ---
>> drivers/ptp/ptp_ocp.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>> 
>> diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
>> index 92edf772feed..9b2ba06ebf97 100644
>> --- a/drivers/ptp/ptp_ocp.c
>> +++ b/drivers/ptp/ptp_ocp.c
>> @@ -763,7 +763,7 @@ ptp_ocp_devlink_flash(struct devlink *devlink, struct device *dev,
>>    size_t off, len, resid, wrote;
>>    struct erase_info erase;
>>    size_t base, blksz;
>> -    int err;
>> +    int err = 0;
>> 
>>    off = 0;
>>    base = bp->flash_start;
>> @@ -847,8 +847,6 @@ ptp_ocp_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req,
>>                                   "loader",
>>                                   buf);
>>        }
>> -        if (err)
>> -            return err;
> 
> Looks like an accidental change, but it's mentioned in the commit log?

Yes, intentional, I spotted this NOP when fixing the compiler warning. 
— 
Jonathan 

  reply	other threads:[~2021-08-12 22:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 18:31 [PATCH net-next 0/3] ptp: ocp: minor updates Jonathan Lemon
2021-08-11 18:31 ` [PATCH net-next 1/3] ptp: ocp: Fix uninitialized variable warning spotted by clang Jonathan Lemon
2021-08-12 21:58   ` Jakub Kicinski
2021-08-12 22:06     ` Jonathan Lemon [this message]
2021-08-11 18:31 ` [PATCH net-next 2/3] ptp: ocp: Fix error path for pci_ocp_device_init() Jonathan Lemon
2021-08-12 21:59   ` Jakub Kicinski
2021-08-11 18:31 ` [PATCH net-next 3/3] MAINTAINERS: Update for ptp_ocp driver Jonathan Lemon

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=09073BD9-9334-494A-802E-4907CF0F0470@fb.com \
    --to=bsd@fb.com \
    --cc=Kernel-team@fb.com \
    --cc=davem@davemloft.net \
    --cc=jonathan.lemon@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --subject='Re: [PATCH net-next 1/3] ptp: ocp: Fix uninitialized variable warning spotted by clang.' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).