Skip to content

Commit 89ae35e

Browse files
frenzymadnesshroncok
authored andcommitted
Unify the way how to return None
Fixes #39 Merges #41
1 parent b9183de commit 89ae35e

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

python-ethtool/ethtool.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,7 @@ static PyObject *set_tso(PyObject *self __unused, PyObject *args)
593593
if (dev_set_int_value(ETHTOOL_STSO, args) < 0)
594594
return NULL;
595595

596-
Py_INCREF(Py_None);
597-
return Py_None;
596+
Py_RETURN_NONE;
598597
}
599598

600599
static PyObject *get_ufo(PyObject *self __unused, PyObject *args)
@@ -622,8 +621,7 @@ static PyObject *set_gso(PyObject *self __unused, PyObject *args)
622621
if (dev_set_int_value(ETHTOOL_SGSO, args) < 0)
623622
return NULL;
624623

625-
Py_INCREF(Py_None);
626-
return Py_None;
624+
Py_RETURN_NONE;
627625
}
628626

629627
static PyObject *get_gro(PyObject *self __unused, PyObject *args)
@@ -641,8 +639,7 @@ static PyObject *set_gro(PyObject *self __unused, PyObject *args)
641639
if (dev_set_int_value(ETHTOOL_SGRO, args) < 0)
642640
return NULL;
643641

644-
Py_INCREF(Py_None);
645-
return Py_None;
642+
Py_RETURN_NONE;
646643
}
647644

648645
static PyObject *get_sg(PyObject *self __unused, PyObject *args)
@@ -826,8 +823,7 @@ static PyObject *set_coalesce(PyObject *self __unused, PyObject *args)
826823
if (send_command(ETHTOOL_SCOALESCE, devname, &coal))
827824
return NULL;
828825

829-
Py_INCREF(Py_None);
830-
return Py_None;
826+
Py_RETURN_NONE;
831827
}
832828

833829
struct struct_desc ethtool_ringparam_desc[] = {
@@ -866,8 +862,7 @@ static PyObject *set_ringparam(PyObject *self __unused, PyObject *args)
866862
if (send_command(ETHTOOL_SRINGPARAM, devname, &ring))
867863
return NULL;
868864

869-
Py_INCREF(Py_None);
870-
return Py_None;
865+
Py_RETURN_NONE;
871866
}
872867

873868
static struct PyMethodDef PyEthModuleMethods[] = {

0 commit comments

Comments
 (0)