* [PATCH, net] ibmvnic: fix empty firmware version and errors cleanup
@ 2018-02-05 16:33 Desnes Augusto Nunes do Rosario
2018-02-06 2:28 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Desnes Augusto Nunes do Rosario @ 2018-02-05 16:33 UTC (permalink / raw)
To: netdev; +Cc: linuxppc-dev, tyreld, tlfalcon, jallen, nfont
This patch makes sure that the firmware version is never NULL. Moreover,
it also performs some cleanup on the error messages.
Fixes: a107311d7fdf ("ibmvnic: fix firmware version when no firmware level
has been provided by the VIOS server")
Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.vnet.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 5caaa9033841..afaf29b201dc 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -3286,7 +3286,7 @@ static void handle_vpd_rsp(union ibmvnic_crq *crq,
struct ibmvnic_adapter *adapter)
{
struct device *dev = &adapter->vdev->dev;
- unsigned char *substr = NULL, *ptr = NULL;
+ unsigned char *substr = NULL;
u8 fw_level_len = 0;
memset(adapter->fw_version, 0, 32);
@@ -3306,10 +3306,6 @@ static void handle_vpd_rsp(union ibmvnic_crq *crq,
substr = strnstr(adapter->vpd->buff, "RM", adapter->vpd->len);
if (!substr) {
dev_info(dev, "Warning - No FW level has been provided in the VPD buffer by the VIOS Server\n");
- ptr = strncpy((char *)adapter->fw_version, "N/A",
- 3 * sizeof(char));
- if (!ptr)
- dev_err(dev, "Failed to inform that firmware version is unavailable to the adapter\n");
goto complete;
}
@@ -3324,16 +3320,14 @@ static void handle_vpd_rsp(union ibmvnic_crq *crq,
/* copy firmware version string from vpd into adapter */
if ((substr + 3 + fw_level_len) <
(adapter->vpd->buff + adapter->vpd->len)) {
- ptr = strncpy((char *)adapter->fw_version,
- substr + 3, fw_level_len);
-
- if (!ptr)
- dev_err(dev, "Failed to isolate FW level string\n");
+ strncpy((char *)adapter->fw_version, substr + 3, fw_level_len);
} else {
dev_info(dev, "FW substr extrapolated VPD buff\n");
}
complete:
+ if (adapter->fw_version[0] == '\0')
+ strncpy((char *)adapter->fw_version, "N/A", 3 * sizeof(char));
complete(&adapter->fw_done);
}
--
2.14.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH, net] ibmvnic: fix empty firmware version and errors cleanup
2018-02-05 16:33 [PATCH, net] ibmvnic: fix empty firmware version and errors cleanup Desnes Augusto Nunes do Rosario
@ 2018-02-06 2:28 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-02-06 2:28 UTC (permalink / raw)
To: desnesn; +Cc: netdev, linuxppc-dev, tyreld, tlfalcon, jallen, nfont
From: Desnes Augusto Nunes do Rosario <desnesn@linux.vnet.ibm.com>
Date: Mon, 5 Feb 2018 14:33:55 -0200
> This patch makes sure that the firmware version is never NULL. Moreover,
> it also performs some cleanup on the error messages.
>
> Fixes: a107311d7fdf ("ibmvnic: fix firmware version when no firmware level
> has been provided by the VIOS server")
> Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.vnet.ibm.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-06 2:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-05 16:33 [PATCH, net] ibmvnic: fix empty firmware version and errors cleanup Desnes Augusto Nunes do Rosario
2018-02-06 2:28 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.