Re: [PATCH] staging: kpc2000: Use memset to initialize resources

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 24, 2019 at 11:57:43AM -0700, Nathan Chancellor wrote:
> diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
> index ad2cc0a3bfa1..13f544f3c0b9 100644
> --- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
> +++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
> @@ -93,8 +93,8 @@ void parse_core_table_entry(struct core_table_entry *cte, const u64 read_val, co
>  int  probe_core_basic(unsigned int core_num, struct kp2000_device *pcard, char *name, const struct core_table_entry cte)
>  {
>      struct mfd_cell  cell = {0};
> -    struct resource  resources[2] = {0};
> -    
> +    struct resource  resources[2];
> +
>      struct kpc_core_device_platdata  core_pdata = {

Greg already applied this and that's cool but I would have probably
gone with "struct resource resources[2] = {};".  memset() is only
required if we want to clear out the struct holes because we're going to
copy the whole struct to userspace.  (Some compilers will change
foo = {} into "foo.a = 0; foo.b = 0;" when it's faster than doing a
memset, so the struct holes don't always get cleared).

Also it was risky from a process perspective to delete the stray tab
from the next line because some one could have argued that it was
unrelated or that the whole line should be removed instead.  You would
have had to redo the patch for something silly... #YOLO #LivingOnTheEdge

But in this case, it's already applied so everything worked out. :)

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux