lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 22 Nov 2023 11:50:15 -0800
From:   Amit Dhingra <mechanicalamit@...il.com>
To:     Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
Cc:     Markus Elfring <Markus.Elfring@....de>, kernel@...gutronix.de,
        kernel-janitors@...r.kernel.org, Mark Brown <broonie@...nel.org>,
        linux-spi@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
        cocci@...ia.fr
Subject: Re: spi: cadence-xspi: Drop useless assignment to NULL

On Tue, Nov 21, 2023 at 09:32:46AM +0100, Uwe Kleine-König wrote:
> They are syntactically fine as they don't change the semantic of the
> code. But assignments to NULL (and still more to 0) also serve the human
> reader as documentation.

Agree on the face that explicit assignment in most cases is good documentation
and is done on purpose by the author. I believe most of the assignments
fall in that category.

There are a few(a dozen or so) that seem to assign all members to NULL.
These can be good candidates for simplification and might be the easy
ones. A few examples below.

diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c
b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c
index 268ffe4da53c..39fcccec53ee 100644
--- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c
@@ -274,10 +274,6 @@ static int s5p_mfc_ctx_ready(struct s5p_mfc_ctx *ctx)
}

static const struct s5p_mfc_codec_ops decoder_codec_ops = {
- .pre_seq_start = NULL,
- .post_seq_start = NULL,
- .pre_frame_start = NULL,
- .post_frame_start = NULL,
};

diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
index 26c385582c3b..f4e71a5a8f84 100644
--- a/arch/microblaze/kernel/timer.c
+++ b/arch/microblaze/kernel/timer.c
@@ -190,7 +190,6 @@ static u64 xilinx_read(struct clocksource *cs)
}

static struct timecounter xilinx_tc = {
- .cc = NULL,
};

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
index 739298d2dff3..8c2ccd33bf2d 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
@@ -500,8 +500,6 @@ static uint32_t dce_aux_configure_timeout(struct
ddc_service *ddc,
}

static struct dce_aux_funcs aux_functions = {
- .configure_timeout = NULL,
- .destroy = NULL,
};

diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c
index 05283ac68f2d..0bf25cead4c4 100644
--- a/drivers/media/i2c/lm3560.c
+++ b/drivers/media/i2c/lm3560.c
@@ -337,7 +337,6 @@ static int lm3560_init_controls(struct lm3560_flash *flash,

/bin /boot /dev /etc /home /lib /lib64 /mnt /opt /proc /root /run
/sbin /srv /sys /tmp /usr /var initialize device bin/ build/ develop/
go/ mytmp/ notmuchmail/ oldbuild/ smatch_stuff/
static const struct v4l2_subdev_ops lm3560_ops = {
- .core = NULL,
};

diff --git a include/linux/qed/qed_ll2_if.h b/include/linux/qed/qed_ll2_if.h
index 5b67cd03276e..f4f8b66b5d36 100644
--- a/include/linux/qed/qed_ll2_if.h
+++ b/include/linux/qed/qed_ll2_if.h
@@ -268,11 +268,6 @@ int qed_ll2_alloc_if(struct qed_dev *);
void qed_ll2_dealloc_if(struct qed_dev *);
#else
static const struct qed_ll2_ops qed_ll2_ops_pass = {
- .start = NULL,
- .stop = NULL,
- .start_xmit = NULL,
- .register_cb_ops = NULL,
- .get_stats = NULL,
};

- Amit

Powered by blists - more mailing lists