Commit 1588f5a9 authored by Bernard Zhao's avatar Bernard Zhao Committed by Paolo Abeni

ethernet/ti: delete if NULL check befort devm_kfree

devm_kfree check the pointer, there is no need to check before
devm_kfree call.
This change is to cleanup the code a bit.
Signed-off-by: default avatarBernard Zhao <bernard@vivo.com>
Link: https://lore.kernel.org/r/20220516015208.6526-1-bernard@vivo.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 6251264f
...@@ -166,8 +166,7 @@ static void am65_cpsw_admin_to_oper(struct net_device *ndev) ...@@ -166,8 +166,7 @@ static void am65_cpsw_admin_to_oper(struct net_device *ndev)
{ {
struct am65_cpsw_port *port = am65_ndev_to_port(ndev); struct am65_cpsw_port *port = am65_ndev_to_port(ndev);
if (port->qos.est_oper) devm_kfree(&ndev->dev, port->qos.est_oper);
devm_kfree(&ndev->dev, port->qos.est_oper);
port->qos.est_oper = port->qos.est_admin; port->qos.est_oper = port->qos.est_admin;
port->qos.est_admin = NULL; port->qos.est_admin = NULL;
...@@ -434,11 +433,8 @@ static void am65_cpsw_purge_est(struct net_device *ndev) ...@@ -434,11 +433,8 @@ static void am65_cpsw_purge_est(struct net_device *ndev)
am65_cpsw_stop_est(ndev); am65_cpsw_stop_est(ndev);
if (port->qos.est_admin) devm_kfree(&ndev->dev, port->qos.est_admin);
devm_kfree(&ndev->dev, port->qos.est_admin); devm_kfree(&ndev->dev, port->qos.est_oper);
if (port->qos.est_oper)
devm_kfree(&ndev->dev, port->qos.est_oper);
port->qos.est_oper = NULL; port->qos.est_oper = NULL;
port->qos.est_admin = NULL; port->qos.est_admin = NULL;
...@@ -524,8 +520,7 @@ static int am65_cpsw_set_taprio(struct net_device *ndev, void *type_data) ...@@ -524,8 +520,7 @@ static int am65_cpsw_set_taprio(struct net_device *ndev, void *type_data)
ret = am65_cpsw_configure_taprio(ndev, est_new); ret = am65_cpsw_configure_taprio(ndev, est_new);
if (!ret) { if (!ret) {
if (taprio->enable) { if (taprio->enable) {
if (port->qos.est_admin) devm_kfree(&ndev->dev, port->qos.est_admin);
devm_kfree(&ndev->dev, port->qos.est_admin);
port->qos.est_admin = est_new; port->qos.est_admin = est_new;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment