On 04/07/2020 05:16, kernel test robot wrote:
>>> drivers/net/ethernet/sfc/ptp.c:1442:1-4: alloc with no test, possible model
>>> on line 1457
This one's a false positive, see below:
> vim +1442 drivers/net/ethernet/sfc/ptp.c
>
> 5d0dab01175bff0 Ben Hutchings 2013-10-16 1434
> ac36baf817c39fc Ben Hutchings 2013-10-15 1435 /* Initialise PTP state. */
> ac36baf817c39fc Ben Hutchings 2013-10-15 1436 int efx_ptp_probe(struct
> efx_nic *efx, struct efx_channel *channel)
> 7c236c43b838221 Stuart Hodgson 2012-09-03 1437 {
> 7c236c43b838221 Stuart Hodgson 2012-09-03 1438 struct efx_ptp_data
> *ptp;
> 7c236c43b838221 Stuart Hodgson 2012-09-03 1439 int rc = 0;
> 7c236c43b838221 Stuart Hodgson 2012-09-03 1440 unsigned int pos;
> 7c236c43b838221 Stuart Hodgson 2012-09-03 1441
> 7c236c43b838221 Stuart Hodgson 2012-09-03 @1442 ptp =
> kzalloc(sizeof(struct efx_ptp_data), GFP_KERNEL);
We allocate ptp...
> 7c236c43b838221 Stuart Hodgson 2012-09-03 1443 efx->ptp_data = ptp;
... assign it to efx->ptp_data...
> 7c236c43b838221 Stuart Hodgson 2012-09-03 1444 if (!efx->ptp_data)
> 7c236c43b838221 Stuart Hodgson 2012-09-03 1445 return -ENOMEM;
... which we then test.
So by here...
> 7c236c43b838221 Stuart Hodgson 2012-09-03 @1457 ptp->workwq =
> create_singlethread_workqueue("sfc_ptp");
... we know ptp is non-NULL.
-ed