Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH 1/5] Input: pxrc - do not store USB device in private struct
From: Dmitry Torokhov @ 2018-07-24  2:35 UTC (permalink / raw)
  To: Marcus Folkesson; +Cc: linux-input, linux-kernel, Alexey Khoroshilov

From: Marcus Folkesson <marcus.folkesson@gmail.com>

The USB device is only needed during setup, so put it back after
initialization and do not store it in our private struct.

Also, the USB device is a parent of USB interface so our driver
model rules ensure that USB device should not disappear while
interface device is still there; there is no need to take reference
to the USB device.

Reported-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Patchwork-Id: 10526903
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/joystick/pxrc.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/input/joystick/pxrc.c b/drivers/input/joystick/pxrc.c
index 07a0dbd3ced2..000b9b7da744 100644
--- a/drivers/input/joystick/pxrc.c
+++ b/drivers/input/joystick/pxrc.c
@@ -27,7 +27,6 @@ MODULE_DEVICE_TABLE(usb, pxrc_table);
 
 struct pxrc {
 	struct input_dev	*input;
-	struct usb_device	*udev;
 	struct usb_interface	*intf;
 	struct urb		*urb;
 	struct mutex		pm_mutex;
@@ -122,6 +121,7 @@ static void pxrc_close(struct input_dev *input)
 
 static int pxrc_usb_init(struct pxrc *pxrc)
 {
+	struct usb_device *udev = interface_to_usbdev(pxrc->intf);
 	struct usb_endpoint_descriptor *epirq;
 	unsigned int pipe;
 	int retval;
@@ -145,7 +145,7 @@ static int pxrc_usb_init(struct pxrc *pxrc)
 	}
 
 	usb_set_intfdata(pxrc->intf, pxrc);
-	usb_make_path(pxrc->udev, pxrc->phys, sizeof(pxrc->phys));
+	usb_make_path(udev, pxrc->phys, sizeof(pxrc->phys));
 	strlcat(pxrc->phys, "/input0", sizeof(pxrc->phys));
 
 	pxrc->urb = usb_alloc_urb(0, GFP_KERNEL);
@@ -154,9 +154,9 @@ static int pxrc_usb_init(struct pxrc *pxrc)
 		goto error;
 	}
 
-	pipe = usb_rcvintpipe(pxrc->udev, pxrc->epaddr),
-	usb_fill_int_urb(pxrc->urb, pxrc->udev, pipe, pxrc->data, pxrc->bsize,
-						pxrc_usb_irq, pxrc, 1);
+	pipe = usb_rcvintpipe(udev, pxrc->epaddr),
+	usb_fill_int_urb(pxrc->urb, udev, pipe, pxrc->data, pxrc->bsize,
+			 pxrc_usb_irq, pxrc, 1);
 
 error:
 	return retval;
@@ -174,7 +174,7 @@ static int pxrc_input_init(struct pxrc *pxrc)
 
 	pxrc->input->name = "PXRC Flight Controller Adapter";
 	pxrc->input->phys = pxrc->phys;
-	usb_to_input_id(pxrc->udev, &pxrc->input->id);
+	usb_to_input_id(interface_to_usbdev(pxrc->intf), &pxrc->input->id);
 
 	pxrc->input->open = pxrc_open;
 	pxrc->input->close = pxrc_close;
@@ -204,7 +204,6 @@ static int pxrc_probe(struct usb_interface *intf,
 		return -ENOMEM;
 
 	mutex_init(&pxrc->pm_mutex);
-	pxrc->udev = usb_get_dev(interface_to_usbdev(intf));
 	pxrc->intf = intf;
 
 	retval = pxrc_usb_init(pxrc);
-- 
2.11.0

^ permalink raw reply related

* Re: [PATCH v3 1/3] Input: edt-ft5x06 - Add support for regulator
From: Dmitry Torokhov @ 2018-07-23 22:39 UTC (permalink / raw)
  To: Mylène Josserand, robh+dt, mark.rutland, maxime.ripard, wens,
	devicetree, linux-kernel, thomas.petazzoni, linux-input,
	linux-arm-kernel
In-Reply-To: <20180718224645.ns7nvqxvqc6huxcz@core>

On Thu, Jul 19, 2018 at 12:46:45AM +0200, Ondřej Jirman wrote:
> Hello Mylène,
> 
> On Wed, Jul 18, 2018 at 08:27:17PM +0200, Mylène Josserand wrote:
> > Add the support of regulator to use it as VCC source.
> > 
> > Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
> > ---
> >  .../bindings/input/touchscreen/edt-ft5x06.txt      |  1 +
> >  drivers/input/touchscreen/edt-ft5x06.c             | 29 ++++++++++++++++++++++
> >  2 files changed, 30 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
> > index 025cf8c9324a..48e975b9c1aa 100644
> > --- a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
> > +++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
> > @@ -30,6 +30,7 @@ Required properties:
> >  Optional properties:
> >   - reset-gpios: GPIO specification for the RESET input
> >   - wake-gpios:  GPIO specification for the WAKE input
> > + - vcc-supply:  Regulator that supplies the touchscreen
> >  
> >   - pinctrl-names: should be "default"
> >   - pinctrl-0:   a phandle pointing to the pin settings for the
> > diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
> > index 1e18ca0d1b4e..aa94494b06b5 100644
> > --- a/drivers/input/touchscreen/edt-ft5x06.c
> > +++ b/drivers/input/touchscreen/edt-ft5x06.c
> > @@ -39,6 +39,7 @@
> >  #include <linux/input/mt.h>
> >  #include <linux/input/touchscreen.h>
> >  #include <linux/of_device.h>
> > +#include <linux/regulator/consumer.h>
> >  
> >  #define WORK_REGISTER_THRESHOLD		0x00
> >  #define WORK_REGISTER_REPORT_RATE	0x08
> > @@ -91,6 +92,7 @@ struct edt_ft5x06_ts_data {
> >  	struct touchscreen_properties prop;
> >  	u16 num_x;
> >  	u16 num_y;
> > +	struct regulator *vcc;
> >  
> >  	struct gpio_desc *reset_gpio;
> >  	struct gpio_desc *wake_gpio;
> > @@ -991,6 +993,22 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
> >  
> >  	tsdata->max_support_points = chip_data->max_support_points;
> >  
> > +	tsdata->vcc = devm_regulator_get(&client->dev, "vcc");
> > +	if (IS_ERR(tsdata->vcc)) {
> > +		error = PTR_ERR(tsdata->vcc);
> > +		if (error != -EPROBE_DEFER)
> > +			dev_err(&client->dev, "failed to request regulator: %d\n",
> > +				error);
> > +		return error;
> > +	}
> > +
> > +	error = regulator_enable(tsdata->vcc);
> > +	if (error < 0) {
> > +		dev_err(&client->dev, "failed to enable vcc: %d\n",
> > +			error);
> > +		return error;
> > +	}
> > +
> >  	tsdata->reset_gpio = devm_gpiod_get_optional(&client->dev,
> >  						     "reset", GPIOD_OUT_HIGH);
> >  	if (IS_ERR(tsdata->reset_gpio)) {

You need to disable regulator here. We do not have
devm_regulator_enable() (and Mark had some concerns about mixing managed
and unmanaged APIs for regulators so we can't simply introduce it),
so I'd recommend using devm_add_action_or_reset() and iunstall custom
action to turn off regulator.

> > @@ -1120,20 +1138,31 @@ static int edt_ft5x06_ts_remove(struct i2c_client *client)
> >  static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)
> >  {
> >  	struct i2c_client *client = to_i2c_client(dev);
> > +	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
> >  
> >  	if (device_may_wakeup(dev))
> >  		enable_irq_wake(client->irq);
> >  
> > +	regulator_disable(tsdata->vcc);
> > +
> 
> How will the touchscreen wakeup the system with interrupt if you power it off
> on suspend? Perhaps guard this with device_may_wakeup() too? 

Exactly, it should be in an "else" branch.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v1 07/10] Input: atmel_mxt_ts - zero terminate config firmware file
From: Dmitry Torokhov @ 2018-07-23 22:35 UTC (permalink / raw)
  To: Nick Dyer
  Cc: linux-kernel, linux-input, Chris Healy, Nikita Yushchenko,
	Lucas Stach, Nick Dyer
In-Reply-To: <20180720215122.23558-7-nick@shmanahar.org>

On Fri, Jul 20, 2018 at 10:51:19PM +0100, Nick Dyer wrote:
> From: Nick Dyer <nick.dyer@itdev.co.uk>
> 
> We use sscanf to parse the configuration file, so it's necessary to zero
> terminate the configuration otherwise a truncated file can cause the
> parser to run off into uninitialised memory.
> 
> Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
> ---
>  drivers/input/touchscreen/atmel_mxt_ts.c | 36 +++++++++++++++++-------
>  1 file changed, 26 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index 0ce126e918f1..2d1fddafb7f9 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -279,7 +279,7 @@ enum mxt_suspend_mode {
>  
>  /* Config update context */
>  struct mxt_cfg {
> -	const u8 *raw;
> +	u8 *raw;
>  	size_t raw_size;
>  	off_t raw_pos;
>  
> @@ -1451,14 +1451,21 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *fw)
>  	u32 info_crc, config_crc, calculated_crc;
>  	u16 crc_start = 0;
>  
> -	cfg.raw = fw->data;
> +	/* Make zero terminated copy of the OBP_RAW file */
> +	cfg.raw = kzalloc(fw->size + 1, GFP_KERNEL);

kmemdup_nul()? I guess config it not that big to be concerned with
kmalloc() vs vmalloc() and allocation failures...

> +	if (!cfg.raw)
> +		return -ENOMEM;
> +
> +	memcpy(cfg.raw, fw->data, fw->size);
> +	cfg.raw[fw->size] = '\0';
>  	cfg.raw_size = fw->size;
>  
>  	mxt_update_crc(data, MXT_COMMAND_REPORTALL, 1);
>  
>  	if (strncmp(cfg.raw, MXT_CFG_MAGIC, strlen(MXT_CFG_MAGIC))) {
>  		dev_err(dev, "Unrecognised config file\n");
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		goto release_raw;
>  	}
>  
>  	cfg.raw_pos = strlen(MXT_CFG_MAGIC);
> @@ -1470,7 +1477,8 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *fw)
>  			     &offset);
>  		if (ret != 1) {
>  			dev_err(dev, "Bad format\n");
> -			return -EINVAL;
> +			ret = -EINVAL;
> +			goto release_raw;
>  		}
>  
>  		cfg.raw_pos += offset;
> @@ -1478,26 +1486,30 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *fw)
>  
>  	if (cfg.info.family_id != data->info->family_id) {
>  		dev_err(dev, "Family ID mismatch!\n");
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		goto release_raw;
>  	}
>  
>  	if (cfg.info.variant_id != data->info->variant_id) {
>  		dev_err(dev, "Variant ID mismatch!\n");
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		goto release_raw;
>  	}
>  
>  	/* Read CRCs */
>  	ret = sscanf(cfg.raw + cfg.raw_pos, "%x%n", &info_crc, &offset);
>  	if (ret != 1) {
>  		dev_err(dev, "Bad format: failed to parse Info CRC\n");
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		goto release_raw;
>  	}
>  	cfg.raw_pos += offset;
>  
>  	ret = sscanf(cfg.raw + cfg.raw_pos, "%x%n", &config_crc, &offset);
>  	if (ret != 1) {
>  		dev_err(dev, "Bad format: failed to parse Config CRC\n");
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		goto release_raw;
>  	}
>  	cfg.raw_pos += offset;
>  
> @@ -1530,8 +1542,10 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *fw)
>  			MXT_INFO_CHECKSUM_SIZE;
>  	cfg.mem_size = data->mem_size - cfg.start_ofs;
>  	cfg.mem = kzalloc(cfg.mem_size, GFP_KERNEL);
> -	if (!cfg.mem)
> -		return -ENOMEM;
> +	if (!cfg.mem) {
> +		ret = -ENOMEM;
> +		goto release_raw;
> +	}
>  
>  	ret = mxt_prepare_cfg_mem(data, &cfg);
>  	if (ret)
> @@ -1570,6 +1584,8 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *fw)
>  	/* T7 config may have changed */
>  	mxt_init_t7_power_cfg(data);
>  
> +release_raw:
> +	kfree(cfg.raw);
>  release_mem:
>  	kfree(cfg.mem);
>  	return ret;
> -- 
> 2.17.1
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v1 09/10] Input: atmel_mxt_ts - tool type is ignored when slot is closed
From: Dmitry Torokhov @ 2018-07-23 22:33 UTC (permalink / raw)
  To: Nick Dyer, Benjamin Tissoires
  Cc: linux-kernel, linux-input, Chris Healy, Nikita Yushchenko,
	Lucas Stach, Nick Dyer
In-Reply-To: <20180720215122.23558-9-nick@shmanahar.org>

On Fri, Jul 20, 2018 at 10:51:21PM +0100, Nick Dyer wrote:
> From: Nick Dyer <nick.dyer@itdev.co.uk>
> 
> input_mt_report_slot_state() ignores the tool when the slot is closed.
> Remove the tool type from these function calls, which has caused a bit of
> confusion.

Hmm, maybe we could introduce MT_TOOL_NONE or MT_TOOL_INACTIVE and get
rid of the 3rd parameter? It will require a bit of macro trickery for a
release or 2...

> 
> Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
> ---
>  drivers/input/touchscreen/atmel_mxt_ts.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index d7023d261458..c31af790ef84 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -838,8 +838,7 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message)
>  		 * have happened.
>  		 */
>  		if (status & MXT_T9_RELEASE) {
> -			input_mt_report_slot_state(input_dev,
> -						   MT_TOOL_FINGER, 0);
> +			input_mt_report_slot_state(input_dev, 0, 0);
>  			mxt_input_sync(data);
>  		}
>  
> @@ -855,7 +854,7 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message)
>  		input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, area);
>  	} else {
>  		/* Touch no longer active, close out slot */
> -		input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, 0);
> +		input_mt_report_slot_state(input_dev, 0, 0);
>  	}
>  
>  	data->update_input = true;
> -- 
> 2.17.1
> 

-- 
Dmitry

^ permalink raw reply

* Re: HID: intel_ish-hid: tx_buf memory leak on probe/remove
From: Srinivas Pandruvada @ 2018-07-23 21:55 UTC (permalink / raw)
  To: Anton Vasilyev
  Cc: Jiri Kosina, Benjamin Tissoires, Even Xu, linux-input,
	linux-kernel, ldv-project
In-Reply-To: <a0faf8a7-17ea-0ed3-5bb5-f1e8fb5debf6@ispras.ru>

On Mon, 2018-07-23 at 20:56 +0300, Anton Vasilyev wrote:
> ish_dev_init() allocates 512*176 bytes memory for tx_buf and stores
> it at
> &dev->wr_free_list_head.link list on ish_probe().
> But there is no deallocation of this memory in ish_remove() and in 
> ish_probe()
> error path.
> So current intel-ish-ipc provides 88 KB memory leak for each
> probe/release.
> 
> I have two ideas 1) to replace kzalloc allocation by devm_kzalloc,
Thanks for finding this. We can replace both alloc in this function
with devm_ calls. Once you have a patch I can test.

Thanks,
Srinivas 

> or 2) release memory stored at &dev->wr_free_list_head.link list
> (and 
> may be at
> &dev->wr_processing_list_head.link) in all driver exits.
> 
> But I do not know which way is preferable for this case.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> --
> Anton Vasilyev
> Linux Verification Center, ISPRAS
> web: http://linuxtesting.org
> e-mail: vasilyev@ispras.ru

^ permalink raw reply

* Re: [PATCH 05/11] touchscreen: elants: Use octal permissions
From: Harshit Jain @ 2018-07-23 20:17 UTC (permalink / raw)
  To: Joe Perches
  Cc: Guenter Roeck, Dmitry Torokhov, Greg Kroah-Hartman, trivial,
	Simon Budig, Andi Shyti, Luca Ceresoli, linux-input, linux-kernel
In-Reply-To: <5ac390c1cdf14656624dcc1f2816ab4d694d0d4f.camel@perches.com>

[-- Attachment #1: Type: text/plain, Size: 842 bytes --]

I ran a treewide script and changed them all to octal and built a kernel
which i am currently running on my machine, I have used DEVICE_ATTR_RO()
for 0444's where possible if i dont find any regressions I will post a
patch for review. I think i will be testing it at least for a week.

On Tue, Jul 24, 2018 at 12:00 AM, Joe Perches <joe@perches.com> wrote:

> On Mon, 2018-07-23 at 11:24 -0700, Guenter Roeck wrote:
> > There are much more urgent issues to fix there (such as, for example,
> > converting the "offending" drivers to the latest API, which would
> > magically cause most of the offenders to disappear).
>
> Perhaps posting a list of desired hwmon changes could help.
>
> Documentation/hwmon/submitting-patches does not seem to specify
> what the "latest API" is nor describe what changes would be
> required in older drivers.
>

[-- Attachment #2: Type: text/html, Size: 1222 bytes --]

^ permalink raw reply

* Re: [PATCH 05/11] touchscreen: elants: Use octal permissions
From: Joe Perches @ 2018-07-23 18:30 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Dmitry Torokhov, Greg Kroah-Hartman, dev-harsh1998, trivial,
	Simon Budig, Andi Shyti, Luca Ceresoli, linux-input, linux-kernel
In-Reply-To: <20180723182412.GA2964@roeck-us.net>

On Mon, 2018-07-23 at 11:24 -0700, Guenter Roeck wrote:
> There are much more urgent issues to fix there (such as, for example,
> converting the "offending" drivers to the latest API, which would
> magically cause most of the offenders to disappear).

Perhaps posting a list of desired hwmon changes could help.

Documentation/hwmon/submitting-patches does not seem to specify
what the "latest API" is nor describe what changes would be
required in older drivers.

^ permalink raw reply

* Re: [PATCH 05/11] touchscreen: elants: Use octal permissions
From: Guenter Roeck @ 2018-07-23 18:24 UTC (permalink / raw)
  To: Joe Perches
  Cc: Dmitry Torokhov, Greg Kroah-Hartman, dev-harsh1998, trivial,
	Simon Budig, Andi Shyti, Luca Ceresoli, linux-input, linux-kernel
In-Reply-To: <e257bc89eb082e9fdc342d6f794c15a2805c98a9.camel@perches.com>

On Mon, Jul 23, 2018 at 10:25:10AM -0700, Joe Perches wrote:
> On Mon, 2018-07-23 at 10:18 -0700, Dmitry Torokhov wrote:
> > On Mon, Jul 23, 2018 at 03:32:00PM +0200, Greg Kroah-Hartman wrote:
> > > On Mon, Jul 23, 2018 at 06:49:20PM +0530, dev-harsh1998 wrote:
> > > > WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
> > > > +static DEVICE_ATTR(iap_mode, S_IRUGO, show_iap_mode, NULL);
> > > > 
> > > > WARNING: Symbolic permissions 'S_IWUSR' are not preferred. Consider using octal permissions '0200'.
> > > > +static DEVICE_ATTR(update_fw, S_IWUSR, NULL, write_update_fw)
> > > > 
> > > > WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
> > > > +		.dattr = __ATTR(_field, S_IRUGO,			\
> > > > 
> > > > Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
> > > 
> > > This name doesn't match up with the From: line above :(
> > > 
> > > Please fix up and try again.
> > 
> > dtor@dtor-ws:~/kernel/linux-next$ git grep S_IRU | wc -l
> > 7605
> > 
> > We either need to run a tree-wide script or leave this alone. FWIW I am
> > perfectly fine with either octals or symbolic names so I do not see
> > benefit of doing conversion for code that is not known to be broken.
> 
> About half of those are in one subsystem (drivers/hwmon)
> 
> $ git grep -w S_IRUGO | cut -f1,2 -d'/' | \
>   sort | uniq -c | sort -rn | head -10 | cat -n
>      1	   3846 drivers/hwmon
>      2	    748 drivers/scsi
>      3	    215 drivers/infiniband
>      4	    168 drivers/usb
>      5	    109 drivers/media
>      6	    106 drivers/input
>      7	    102 drivers/platform
>      8	    101 drivers/misc
>      9	    101 drivers/gpu
>     10	     91 drivers/edac
> 
> The generic reason is octal is readable and S_<FOO> is unintelligible.
> 
> https://lkml.org/lkml/2016/8/2/1945
> 

That is Linus' opinion, but not mine. Granted, my opinion doesn't count
much, but enough that I won't waste my time updating the hwmon subsystem
to match the new rules. Rules change all the time, and I am quite sure
checkpatch will find a lot of stuff to complain about (again) in the
hwmon subsystem, after my last spout of cleanup a couple of years ago.
There are much more urgent issues to fix there (such as, for example,
converting the "offending" drivers to the latest API, which would
magically cause most of the offenders to disappear).
No one but me cares about those, so bothering about the use of S_<FOO>
in hwmon seems to be quite pointless. Except, of course, it is quite
useful to have something to point to as bad citizen.

Guenter

^ permalink raw reply

* HID: intel_ish-hid: tx_buf memory leak on probe/remove
From: Anton Vasilyev @ 2018-07-23 17:56 UTC (permalink / raw)
  To: Srinivas Pandruvada
  Cc: Jiri Kosina, Benjamin Tissoires, Even Xu, linux-input,
	linux-kernel, ldv-project, Anton Vasilyev

ish_dev_init() allocates 512*176 bytes memory for tx_buf and stores it at
&dev->wr_free_list_head.link list on ish_probe().
But there is no deallocation of this memory in ish_remove() and in 
ish_probe()
error path.
So current intel-ish-ipc provides 88 KB memory leak for each probe/release.

I have two ideas 1) to replace kzalloc allocation by devm_kzalloc,
or 2) release memory stored at &dev->wr_free_list_head.link list (and 
may be at
&dev->wr_processing_list_head.link) in all driver exits.

But I do not know which way is preferable for this case.

Found by Linux Driver Verification project (linuxtesting.org).

--
Anton Vasilyev
Linux Verification Center, ISPRAS
web: http://linuxtesting.org
e-mail: vasilyev@ispras.ru

^ permalink raw reply

* Re: [PATCH 05/11] touchscreen: elants: Use octal permissions
From: Dmitry Torokhov @ 2018-07-23 17:46 UTC (permalink / raw)
  To: Joe Perches
  Cc: Greg Kroah-Hartman, dev-harsh1998, trivial, Simon Budig,
	Andi Shyti, Luca Ceresoli, Guenter Roeck, linux-input,
	linux-kernel
In-Reply-To: <e257bc89eb082e9fdc342d6f794c15a2805c98a9.camel@perches.com>

On Mon, Jul 23, 2018 at 10:25:10AM -0700, Joe Perches wrote:
> On Mon, 2018-07-23 at 10:18 -0700, Dmitry Torokhov wrote:
> > On Mon, Jul 23, 2018 at 03:32:00PM +0200, Greg Kroah-Hartman wrote:
> > > On Mon, Jul 23, 2018 at 06:49:20PM +0530, dev-harsh1998 wrote:
> > > > WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
> > > > +static DEVICE_ATTR(iap_mode, S_IRUGO, show_iap_mode, NULL);
> > > > 
> > > > WARNING: Symbolic permissions 'S_IWUSR' are not preferred. Consider using octal permissions '0200'.
> > > > +static DEVICE_ATTR(update_fw, S_IWUSR, NULL, write_update_fw)
> > > > 
> > > > WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
> > > > +		.dattr = __ATTR(_field, S_IRUGO,			\
> > > > 
> > > > Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
> > > 
> > > This name doesn't match up with the From: line above :(
> > > 
> > > Please fix up and try again.
> > 
> > dtor@dtor-ws:~/kernel/linux-next$ git grep S_IRU | wc -l
> > 7605
> > 
> > We either need to run a tree-wide script or leave this alone. FWIW I am
> > perfectly fine with either octals or symbolic names so I do not see
> > benefit of doing conversion for code that is not known to be broken.
> 
> About half of those are in one subsystem (drivers/hwmon)
> 
> $ git grep -w S_IRUGO | cut -f1,2 -d'/' | \
>   sort | uniq -c | sort -rn | head -10 | cat -n
>      1	   3846 drivers/hwmon
>      2	    748 drivers/scsi
>      3	    215 drivers/infiniband
>      4	    168 drivers/usb
>      5	    109 drivers/media
>      6	    106 drivers/input
>      7	    102 drivers/platform
>      8	    101 drivers/misc
>      9	    101 drivers/gpu
>     10	     91 drivers/edac
> 
> The generic reason is octal is readable and S_<FOO> is unintelligible.
> 
> https://lkml.org/lkml/2016/8/2/1945

Yes, but please also read this one as well:

https://lkml.org/lkml/2016/8/2/2062

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 05/11] touchscreen: elants: Use octal permissions
From: Joe Perches @ 2018-07-23 17:25 UTC (permalink / raw)
  To: Dmitry Torokhov, Greg Kroah-Hartman
  Cc: dev-harsh1998, trivial, Simon Budig, Andi Shyti, Luca Ceresoli,
	Guenter Roeck, linux-input, linux-kernel
In-Reply-To: <20180723171831.GC100814@dtor-ws>

On Mon, 2018-07-23 at 10:18 -0700, Dmitry Torokhov wrote:
> On Mon, Jul 23, 2018 at 03:32:00PM +0200, Greg Kroah-Hartman wrote:
> > On Mon, Jul 23, 2018 at 06:49:20PM +0530, dev-harsh1998 wrote:
> > > WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
> > > +static DEVICE_ATTR(iap_mode, S_IRUGO, show_iap_mode, NULL);
> > > 
> > > WARNING: Symbolic permissions 'S_IWUSR' are not preferred. Consider using octal permissions '0200'.
> > > +static DEVICE_ATTR(update_fw, S_IWUSR, NULL, write_update_fw)
> > > 
> > > WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
> > > +		.dattr = __ATTR(_field, S_IRUGO,			\
> > > 
> > > Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
> > 
> > This name doesn't match up with the From: line above :(
> > 
> > Please fix up and try again.
> 
> dtor@dtor-ws:~/kernel/linux-next$ git grep S_IRU | wc -l
> 7605
> 
> We either need to run a tree-wide script or leave this alone. FWIW I am
> perfectly fine with either octals or symbolic names so I do not see
> benefit of doing conversion for code that is not known to be broken.

About half of those are in one subsystem (drivers/hwmon)

$ git grep -w S_IRUGO | cut -f1,2 -d'/' | \
  sort | uniq -c | sort -rn | head -10 | cat -n
     1	   3846 drivers/hwmon
     2	    748 drivers/scsi
     3	    215 drivers/infiniband
     4	    168 drivers/usb
     5	    109 drivers/media
     6	    106 drivers/input
     7	    102 drivers/platform
     8	    101 drivers/misc
     9	    101 drivers/gpu
    10	     91 drivers/edac

The generic reason is octal is readable and S_<FOO> is unintelligible.

https://lkml.org/lkml/2016/8/2/1945

^ permalink raw reply

* Re: [PATCH 05/11] touchscreen: elants: Use octal permissions
From: Dmitry Torokhov @ 2018-07-23 17:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: dev-harsh1998, trivial, Simon Budig, Andi Shyti, Luca Ceresoli,
	Joe Perches, Guenter Roeck, linux-input, linux-kernel
In-Reply-To: <20180723133200.GA1167@kroah.com>

On Mon, Jul 23, 2018 at 03:32:00PM +0200, Greg Kroah-Hartman wrote:
> On Mon, Jul 23, 2018 at 06:49:20PM +0530, dev-harsh1998 wrote:
> > WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
> > +static DEVICE_ATTR(iap_mode, S_IRUGO, show_iap_mode, NULL);
> > 
> > WARNING: Symbolic permissions 'S_IWUSR' are not preferred. Consider using octal permissions '0200'.
> > +static DEVICE_ATTR(update_fw, S_IWUSR, NULL, write_update_fw)
> > 
> > WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
> > +		.dattr = __ATTR(_field, S_IRUGO,			\
> > 
> > Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
> 
> This name doesn't match up with the From: line above :(
> 
> Please fix up and try again.

dtor@dtor-ws:~/kernel/linux-next$ git grep S_IRU | wc -l
7605

We either need to run a tree-wide script or leave this alone. FWIW I am
perfectly fine with either octals or symbolic names so I do not see
benefit of doing conversion for code that is not known to be broken.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v7 4/4] kexec_file: Load kernel at top of system RAM if required
From: Michal Hocko @ 2018-07-23 14:34 UTC (permalink / raw)
  To: Baoquan He
  Cc: Andrew Morton, linux-kernel, robh+dt, dan.j.williams,
	nicolas.pitre, josh, fengguang.wu, bp, andy.shevchenko,
	patrik.r.jakobsson, airlied, kys, haiyangz, sthemmin,
	dmitry.torokhov, frowand.list, keith.busch, jonathan.derrick,
	lorenzo.pieralisi, bhelgaas, tglx, brijesh.singh, jglisse,
	thomas.lendacky, gregkh, baiyaowei, richard.weiyang, devel,
	linux-input, linux-nvdimm, devicetree
In-Reply-To: <20180719151753.GB7147@localhost.localdomain>

On Thu 19-07-18 23:17:53, Baoquan He wrote:
> Kexec has been a formal feature in our distro, and customers owning
> those kind of very large machine can make use of this feature to speed
> up the reboot process. On uefi machine, the kexec_file loading will
> search place to put kernel under 4G from top to down. As we know, the
> 1st 4G space is DMA32 ZONE, dma, pci mmcfg, bios etc all try to consume
> it. It may have possibility to not be able to find a usable space for
> kernel/initrd. From the top down of the whole memory space, we don't
> have this worry. 

I do not have the full context here but let me note that you should be
careful when doing top-down reservation because you can easily get into
hotplugable memory and break the hotremove usecase. We even warn when
this is done. See memblock_find_in_range_node
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply

* Re: [PATCH 05/11] touchscreen: elants: Use octal permissions
From: Greg Kroah-Hartman @ 2018-07-23 13:32 UTC (permalink / raw)
  To: dev-harsh1998
  Cc: trivial, Dmitry Torokhov, Simon Budig, Andi Shyti, Luca Ceresoli,
	Joe Perches, Guenter Roeck, linux-input, linux-kernel
In-Reply-To: <20180723131954.30739-4-harshitjain6751@gmail.com>

On Mon, Jul 23, 2018 at 06:49:20PM +0530, dev-harsh1998 wrote:
> WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
> +static DEVICE_ATTR(iap_mode, S_IRUGO, show_iap_mode, NULL);
> 
> WARNING: Symbolic permissions 'S_IWUSR' are not preferred. Consider using octal permissions '0200'.
> +static DEVICE_ATTR(update_fw, S_IWUSR, NULL, write_update_fw)
> 
> WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
> +		.dattr = __ATTR(_field, S_IRUGO,			\
> 
> Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>

This name doesn't match up with the From: line above :(

Please fix up and try again.

thanks,

greg k-h

^ permalink raw reply

* [PATCH 01/11] touchscreen: ft5x06: Use octal permissions
From: dev-harsh1998 @ 2018-07-23 13:19 UTC (permalink / raw)
  To: trivial
  Cc: Harshit Jain, Dmitry Torokhov, Andi Shyti, Simon Budig,
	Luca Ceresoli, linux-input, linux-kernel
In-Reply-To: <20180723131954.30739-1-harshitjain6751@gmail.com>

WARNING: Symbolic permissions 'S_IWUSR | S_IRUGO' are not preferred. Consider using octal permissions '0644'.
+static EDT_ATTR(gain, S_IWUSR | S_IRUGO, WORK_REGISTER_GAIN,

WARNING: Symbolic permissions 'S_IWUSR | S_IRUGO' are not preferred. Consider using octal permissions '0644'.
+static EDT_ATTR(offset, S_IWUSR | S_IRUGO, WORK_REGISTER_OFFSET,

WARNING: Symbolic permissions 'S_IWUSR | S_IRUGO' are not preferred. Consider using octal permissions '0644'.
+static EDT_ATTR(threshold, S_IWUSR | S_IRUGO, WORK_REGISTER_THRESHOLD,

WARNING: Symbolic permissions 'S_IWUSR | S_IRUGO' are not preferred. Consider using octal permissions '0644'.
+static EDT_ATTR(report_rate, S_IWUSR | S_IRUGO, WORK_REGISTER_REPORT_RATE,

WARNING: Symbolic permissions 'S_IRUSR' are not preferred. Consider using octal permissions '0400'.
+	debugfs_create_u16("num_x", S_IRUSR, tsdata->debug_dir, &tsdata->num_x);

WARNING: Symbolic permissions 'S_IRUSR' are not preferred. Consider using octal permissions '0400'.
+	debugfs_create_u16("num_y", S_IRUSR, tsdata->debug_dir, &tsdata->num_y);

WARNING: Symbolic permissions 'S_IRUSR | S_IWUSR' are not preferred. Consider using octal permissions '0600'.
+	debugfs_create_file("mode", S_IRUSR | S_IWUSR,

WARNING: Symbolic permissions 'S_IRUSR' are not preferred. Consider using octal permissions '0400'.
+	debugfs_create_file("raw_data", S_IRUSR,

Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
---
 drivers/input/touchscreen/edt-ft5x06.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 1e18ca0d1b4e..ea4026682e79 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -479,16 +479,16 @@ static ssize_t edt_ft5x06_setting_store(struct device *dev,
 }
 
 /* m06, m09: range 0-31, m12: range 0-5 */
-static EDT_ATTR(gain, S_IWUSR | S_IRUGO, WORK_REGISTER_GAIN,
+static EDT_ATTR(gain, 0644, WORK_REGISTER_GAIN,
 		M09_REGISTER_GAIN, 0, 31);
 /* m06, m09: range 0-31, m12: range 0-16 */
-static EDT_ATTR(offset, S_IWUSR | S_IRUGO, WORK_REGISTER_OFFSET,
+static EDT_ATTR(offset, 0644, WORK_REGISTER_OFFSET,
 		M09_REGISTER_OFFSET, 0, 31);
 /* m06: range 20 to 80, m09: range 0 to 30, m12: range 1 to 255... */
-static EDT_ATTR(threshold, S_IWUSR | S_IRUGO, WORK_REGISTER_THRESHOLD,
+static EDT_ATTR(threshold, 0644, WORK_REGISTER_THRESHOLD,
 		M09_REGISTER_THRESHOLD, 0, 255);
 /* m06: range 3 to 14, m12: (0x64: 100Hz) */
-static EDT_ATTR(report_rate, S_IWUSR | S_IRUGO, WORK_REGISTER_REPORT_RATE,
+static EDT_ATTR(report_rate, 0644, WORK_REGISTER_REPORT_RATE,
 		NO_REGISTER, 0, 255);
 
 static struct attribute *edt_ft5x06_attrs[] = {
@@ -739,12 +739,12 @@ edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata,
 	if (!tsdata->debug_dir)
 		return;
 
-	debugfs_create_u16("num_x", S_IRUSR, tsdata->debug_dir, &tsdata->num_x);
-	debugfs_create_u16("num_y", S_IRUSR, tsdata->debug_dir, &tsdata->num_y);
+	debugfs_create_u16("num_x", 0400, tsdata->debug_dir, &tsdata->num_x);
+	debugfs_create_u16("num_y", 0400, tsdata->debug_dir, &tsdata->num_y);
 
-	debugfs_create_file("mode", S_IRUSR | S_IWUSR,
+	debugfs_create_file("mode", 0600,
 			    tsdata->debug_dir, tsdata, &debugfs_mode_fops);
-	debugfs_create_file("raw_data", S_IRUSR,
+	debugfs_create_file("raw_data", 0400,
 			    tsdata->debug_dir, tsdata, &debugfs_raw_data_fops);
 }
 
-- 
2.17.1

^ permalink raw reply related

* [PATCH 11/11] touchscreen: tsc200x: Use octal permissions
From: dev-harsh1998 @ 2018-07-23 13:19 UTC (permalink / raw)
  To: trivial
  Cc: Harshit Jain, Dmitry Torokhov, Andi Shyti, Simon Budig,
	Luca Ceresoli, Martin Kepplinger, Kees Cook, linux-input,
	linux-kernel
In-Reply-To: <20180723131954.30739-1-harshitjain6751@gmail.com>

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(selftest, S_IRUGO, tsc200x_selftest_show, NULL);

Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
---
 drivers/input/touchscreen/tsc200x-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c
index e0fde590df8e..daefeca101ff 100644
--- a/drivers/input/touchscreen/tsc200x-core.c
+++ b/drivers/input/touchscreen/tsc200x-core.c
@@ -336,7 +336,7 @@ static ssize_t tsc200x_selftest_show(struct device *dev,
 	return sprintf(buf, "%d\n", success);
 }
 
-static DEVICE_ATTR(selftest, S_IRUGO, tsc200x_selftest_show, NULL);
+static DEVICE_ATTR(selftest, 0444, tsc200x_selftest_show, NULL);
 
 static struct attribute *tsc200x_attrs[] = {
 	&dev_attr_selftest.attr,
-- 
2.17.1

^ permalink raw reply related

* [PATCH 10/11] touchscreen: sun4i_ts: Use octal permissions
From: dev-harsh1998 @ 2018-07-23 13:19 UTC (permalink / raw)
  To: trivial
  Cc: Harshit Jain, Dmitry Torokhov, Maxime Ripard, Chen-Yu Tsai,
	Simon Budig, Andi Shyti, Luca Ceresoli, Julia Lawall, linux-input,
	linux-kernel, linux-arm-kernel
In-Reply-To: <20180723131954.30739-1-harshitjain6751@gmail.com>

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL);

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(temp1_label, S_IRUGO, show_temp_label, NULL);

Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
---
 drivers/input/touchscreen/sun4i-ts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index d2e14d9e5975..78960961a524 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -230,8 +230,8 @@ static ssize_t show_temp_label(struct device *dev,
 	return sprintf(buf, "SoC temperature\n");
 }
 
-static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL);
-static DEVICE_ATTR(temp1_label, S_IRUGO, show_temp_label, NULL);
+static DEVICE_ATTR(temp1_input, 0444, show_temp, NULL);
+static DEVICE_ATTR(temp1_label, 0444, show_temp_label, NULL);
 
 static struct attribute *sun4i_ts_attrs[] = {
 	&dev_attr_temp1_input.attr,
-- 
2.17.1

^ permalink raw reply related

* [PATCH 09/11] touchscreen: raydium_ts: Use octal permissions
From: dev-harsh1998 @ 2018-07-23 13:19 UTC (permalink / raw)
  To: trivial
  Cc: Harshit Jain, Dmitry Torokhov, Simon Budig, Andi Shyti,
	Luca Ceresoli, Jeffrey Lin, linux-input, linux-kernel
In-Reply-To: <20180723131954.30739-1-harshitjain6751@gmail.com>

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(fw_version, S_IRUGO, raydium_i2c_fw_ver_show, NULL);

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(hw_version, S_IRUGO, raydium_i2c_hw_ver_show, NULL);

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(boot_mode, S_IRUGO, raydium_i2c_boot_mode_show, NULL);

WARNING: Symbolic permissions 'S_IWUSR' are not preferred. Consider using octal permissions '0200'.
+static DEVICE_ATTR(update_fw, S_IWUSR, NULL, raydium_i2c_update_fw_store);

WARNING: Symbolic permissions 'S_IWUSR' are not preferred. Consider using octal permissions '0200'.
+static DEVICE_ATTR(calibrate, S_IWUSR, NULL, raydium_i2c_calibrate_store);

Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
---
 drivers/input/touchscreen/raydium_i2c_ts.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c
index d1c09e6a2cb6..eddbb51e55dd 100644
--- a/drivers/input/touchscreen/raydium_i2c_ts.c
+++ b/drivers/input/touchscreen/raydium_i2c_ts.c
@@ -934,9 +934,9 @@ static ssize_t raydium_i2c_calibrate_store(struct device *dev,
 	return error ?: count;
 }
 
-static DEVICE_ATTR(fw_version, S_IRUGO, raydium_i2c_fw_ver_show, NULL);
-static DEVICE_ATTR(hw_version, S_IRUGO, raydium_i2c_hw_ver_show, NULL);
-static DEVICE_ATTR(boot_mode, S_IRUGO, raydium_i2c_boot_mode_show, NULL);
+static DEVICE_ATTR(fw_version, 0444, raydium_i2c_fw_ver_show, NULL);
+static DEVICE_ATTR(hw_version, 0444, raydium_i2c_hw_ver_show, NULL);
+static DEVICE_ATTR(boot_mode, 0444, raydium_i2c_boot_mode_show, NULL);
 static DEVICE_ATTR(update_fw, S_IWUSR, NULL, raydium_i2c_update_fw_store);
 static DEVICE_ATTR(calibrate, S_IWUSR, NULL, raydium_i2c_calibrate_store);
 
-- 
2.17.1

^ permalink raw reply related

* [PATCH 08/11] touchscreen: melfas: Use octal permissions
From: dev-harsh1998 @ 2018-07-23 13:19 UTC (permalink / raw)
  To: trivial
  Cc: Harshit Jain, Dmitry Torokhov, Sangwon Jee, Simon Budig,
	Andi Shyti, Luca Ceresoli, linux-input, linux-kernel
In-Reply-To: <20180723131954.30739-1-harshitjain6751@gmail.com>

WARNING: Symbolic permissions 'S_IWUSR' are not preferred. Consider using octal permissions '0200'.
+static DEVICE_ATTR(update_fw, S_IWUSR, NULL, mip4_sysfs_fw_update);

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(fw_version, S_IRUGO, mip4_sysfs_read_fw_version, NULL);

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(hw_version, S_IRUGO, mip4_sysfs_read_hw_version, NULL);

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(product_id, S_IRUGO, mip4_sysfs_read_product_id, NULL);

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(ic_name, S_IRUGO, mip4_sysfs_read_ic_name, NULL);

Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
---
 drivers/input/touchscreen/melfas_mip4.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c
index 430a2bc5f7ca..f7fd940e61ea 100644
--- a/drivers/input/touchscreen/melfas_mip4.c
+++ b/drivers/input/touchscreen/melfas_mip4.c
@@ -1332,7 +1332,7 @@ static ssize_t mip4_sysfs_fw_update(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(update_fw, S_IWUSR, NULL, mip4_sysfs_fw_update);
+static DEVICE_ATTR(update_fw, 0200, NULL, mip4_sysfs_fw_update);
 
 static ssize_t mip4_sysfs_read_fw_version(struct device *dev,
 					  struct device_attribute *attr,
@@ -1354,7 +1354,7 @@ static ssize_t mip4_sysfs_read_fw_version(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(fw_version, S_IRUGO, mip4_sysfs_read_fw_version, NULL);
+static DEVICE_ATTR(fw_version, 0444, mip4_sysfs_read_fw_version, NULL);
 
 static ssize_t mip4_sysfs_read_hw_version(struct device *dev,
 					  struct device_attribute *attr,
@@ -1379,7 +1379,7 @@ static ssize_t mip4_sysfs_read_hw_version(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(hw_version, S_IRUGO, mip4_sysfs_read_hw_version, NULL);
+static DEVICE_ATTR(hw_version, 0444, mip4_sysfs_read_hw_version, NULL);
 
 static ssize_t mip4_sysfs_read_product_id(struct device *dev,
 					  struct device_attribute *attr,
@@ -1398,7 +1398,7 @@ static ssize_t mip4_sysfs_read_product_id(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(product_id, S_IRUGO, mip4_sysfs_read_product_id, NULL);
+static DEVICE_ATTR(product_id, 0444, mip4_sysfs_read_product_id, NULL);
 
 static ssize_t mip4_sysfs_read_ic_name(struct device *dev,
 					  struct device_attribute *attr,
@@ -1418,7 +1418,7 @@ static ssize_t mip4_sysfs_read_ic_name(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(ic_name, S_IRUGO, mip4_sysfs_read_ic_name, NULL);
+static DEVICE_ATTR(ic_name, 0444, mip4_sysfs_read_ic_name, NULL);
 
 static struct attribute *mip4_attrs[] = {
 	&dev_attr_fw_version.attr,
-- 
2.17.1

^ permalink raw reply related

* [PATCH 07/11] touchscreen: mc13783: Use octal permissions
From: dev-harsh1998 @ 2018-07-23 13:19 UTC (permalink / raw)
  To: trivial
  Cc: Harshit Jain, Dmitry Torokhov, Simon Budig, Andi Shyti,
	Luca Ceresoli, linux-input, linux-kernel
In-Reply-To: <20180723131954.30739-1-harshitjain6751@gmail.com>

WARNING: Symbolic permissions 'S_IRUGO | S_IWUSR' are not preferred. Consider using octal permissions '0644'.
+module_param(sample_tolerance, uint, S_IRUGO | S_IWUSR);

Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
---
 drivers/input/touchscreen/mc13783_ts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/mc13783_ts.c b/drivers/input/touchscreen/mc13783_ts.c
index ef64f36c5ffc..4e33349f101e 100644
--- a/drivers/input/touchscreen/mc13783_ts.c
+++ b/drivers/input/touchscreen/mc13783_ts.c
@@ -25,9 +25,9 @@
 #define DEFAULT_SAMPLE_TOLERANCE 300
 
 static unsigned int sample_tolerance = DEFAULT_SAMPLE_TOLERANCE;
-module_param(sample_tolerance, uint, S_IRUGO | S_IWUSR);
+module_param(sample_tolerance, uint, 0644);
 MODULE_PARM_DESC(sample_tolerance,
-		"If the minimal and maximal value read out for one axis (out "
+		"If the minimal and maximum value read out for one axis (out "
 		"of three) differ by this value (default: "
 		__stringify(DEFAULT_SAMPLE_TOLERANCE) ") or more, the reading "
 		"is supposed to be wrong and is discarded.  Set to 0 to "
-- 
2.17.1

^ permalink raw reply related

* [PATCH 06/11] touchscreen: ili210x: Use octal permissions
From: dev-harsh1998 @ 2018-07-23 13:19 UTC (permalink / raw)
  To: trivial
  Cc: Harshit Jain, Dmitry Torokhov, Andi Shyti, Simon Budig,
	Luca Ceresoli, linux-input, linux-kernel
In-Reply-To: <20180723131954.30739-1-harshitjain6751@gmail.com>

WARNING: Symbolic permissions 'S_IWUSR' are not preferred. Consider using octal permissions '0200'.
+static DEVICE_ATTR(calibrate, S_IWUSR, NULL, ili210x_calibrate);

Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
---
 drivers/input/touchscreen/ili210x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
index 6f76eeedf465..07526a6f2cb7 100644
--- a/drivers/input/touchscreen/ili210x.c
+++ b/drivers/input/touchscreen/ili210x.c
@@ -169,7 +169,7 @@ static ssize_t ili210x_calibrate(struct device *dev,
 
 	return count;
 }
-static DEVICE_ATTR(calibrate, S_IWUSR, NULL, ili210x_calibrate);
+static DEVICE_ATTR(calibrate, 0200, NULL, ili210x_calibrate);
 
 static struct attribute *ili210x_attributes[] = {
 	&dev_attr_calibrate.attr,
-- 
2.17.1

^ permalink raw reply related

* [PATCH 05/11] touchscreen: elants: Use octal permissions
From: dev-harsh1998 @ 2018-07-23 13:19 UTC (permalink / raw)
  To: trivial
  Cc: Harshit Jain, Dmitry Torokhov, Simon Budig, Andi Shyti,
	Luca Ceresoli, Greg Kroah-Hartman, Joe Perches, Guenter Roeck,
	linux-input, linux-kernel
In-Reply-To: <20180723131954.30739-1-harshitjain6751@gmail.com>

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(iap_mode, S_IRUGO, show_iap_mode, NULL);

WARNING: Symbolic permissions 'S_IWUSR' are not preferred. Consider using octal permissions '0200'.
+static DEVICE_ATTR(update_fw, S_IWUSR, NULL, write_update_fw)

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+		.dattr = __ATTR(_field, S_IRUGO,			\

Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
---
 drivers/input/touchscreen/elants_i2c.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index d21ca39b0fdb..9717b7c3bb6f 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -1000,8 +1000,8 @@ static ssize_t show_iap_mode(struct device *dev,
 }
 
 static DEVICE_ATTR_WO(calibrate);
-static DEVICE_ATTR(iap_mode, S_IRUGO, show_iap_mode, NULL);
-static DEVICE_ATTR(update_fw, S_IWUSR, NULL, write_update_fw);
+static DEVICE_ATTR(iap_mode, 0444, show_iap_mode, NULL);
+static DEVICE_ATTR(update_fw, 0200, NULL, write_update_fw);
 
 struct elants_version_attribute {
 	struct device_attribute dattr;
@@ -1016,7 +1016,7 @@ struct elants_version_attribute {
 	 __ELANTS_FIELD_SIZE(_field))
 #define ELANTS_VERSION_ATTR(_field)					\
 	struct elants_version_attribute elants_ver_attr_##_field = {	\
-		.dattr = __ATTR(_field, S_IRUGO,			\
+		.dattr = __ATTR(_field, 0444,			\
 				elants_version_attribute_show, NULL),	\
 		.field_offset = offsetof(struct elants_data, _field),	\
 		.field_size = __ELANTS_VERIFY_SIZE(_field),		\
-- 
2.17.1

^ permalink raw reply related

* [PATCH 04/11] touchscreen: amtel: Use octal permissions
From: dev-harsh1998 @ 2018-07-23 13:19 UTC (permalink / raw)
  To: trivial
  Cc: Harshit Jain, Nick Dyer, Dmitry Torokhov, Simon Budig, Andi Shyti,
	Luca Ceresoli, linux-input, linux-kernel
In-Reply-To: <20180723131954.30739-1-harshitjain6751@gmail.com>

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(fw_version, S_IRUGO, mxt_fw_version_show, NULL);

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(hw_version, S_IRUGO, mxt_hw_version_show, NULL);

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(object, S_IRUGO, mxt_object_show, NULL);

WARNING: Symbolic permissions 'S_IWUSR' are not preferred. Consider using octal permissions '0200'.
+static DEVICE_ATTR(update_fw, S_IWUSR, NULL, mxt_update_fw_store);

Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
---
 drivers/input/touchscreen/atmel_mxt_ts.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 54fe190fd4bc..5202a8244f1d 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -2892,10 +2892,10 @@ static ssize_t mxt_update_fw_store(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(fw_version, S_IRUGO, mxt_fw_version_show, NULL);
-static DEVICE_ATTR(hw_version, S_IRUGO, mxt_hw_version_show, NULL);
-static DEVICE_ATTR(object, S_IRUGO, mxt_object_show, NULL);
-static DEVICE_ATTR(update_fw, S_IWUSR, NULL, mxt_update_fw_store);
+static DEVICE_ATTR(fw_version, 0444, mxt_fw_version_show, NULL);
+static DEVICE_ATTR(hw_version, 0444, mxt_hw_version_show, NULL);
+static DEVICE_ATTR(object, 0444, mxt_object_show, NULL);
+static DEVICE_ATTR(update_fw, 0200, NULL, mxt_update_fw_store);
 
 static struct attribute *mxt_attrs[] = {
 	&dev_attr_fw_version.attr,
-- 
2.17.1

^ permalink raw reply related

* [PATCH 03/11] touchscreen: ad7846: Use octal permissions
From: dev-harsh1998 @ 2018-07-23 13:19 UTC (permalink / raw)
  To: trivial
  Cc: Harshit Jain, Dmitry Torokhov, Simon Budig, Andi Shyti,
	Luca Ceresoli, linux-input, linux-kernel
In-Reply-To: <20180723131954.30739-1-harshitjain6751@gmail.com>

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(name, S_IRUGO, name ## _show, NULL);

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(pen_down, S_IRUGO, ads7846_pen_down_show, NULL);

Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
---
 drivers/input/touchscreen/ads7846.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index a2f45aefce08..7c07de0802de 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -431,7 +431,7 @@ name ## _show(struct device *dev, struct device_attribute *attr, char *buf) \
 		return v; \
 	return sprintf(buf, "%u\n", adjust(ts, v)); \
 } \
-static DEVICE_ATTR(name, S_IRUGO, name ## _show, NULL);
+static DEVICE_ATTR(name, 0444, name ## _show, NULL);
 
 
 /* Sysfs conventions report temperatures in millidegrees Celsius.
@@ -561,7 +561,7 @@ static ssize_t ads7846_pen_down_show(struct device *dev,
 	return sprintf(buf, "%u\n", ts->pendown);
 }
 
-static DEVICE_ATTR(pen_down, S_IRUGO, ads7846_pen_down_show, NULL);
+static DEVICE_ATTR(pen_down, 0444, ads7846_pen_down_show, NULL);
 
 static ssize_t ads7846_disable_show(struct device *dev,
 				     struct device_attribute *attr, char *buf)
-- 
2.17.1

^ permalink raw reply related

* [PATCH 02/11] touchscreen: ad7877: Use octal permissions
From: dev-harsh1998 @ 2018-07-23 13:19 UTC (permalink / raw)
  To: trivial
  Cc: Harshit Jain, Michael Hennerich, Dmitry Torokhov, Simon Budig,
	Andi Shyti, Luca Ceresoli, linux-input, linux-kernel

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
+static DEVICE_ATTR(name, S_IRUGO, name ## _show, NULL);

Signed-off-by: Harshit Jain <harshitjain6751@gmail.com>
---
 drivers/input/touchscreen/ad7877.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index 5cfe477ec992..4b4a9d84195e 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -461,7 +461,7 @@ name ## _show(struct device *dev, struct device_attribute *attr, char *buf) \
 		return v; \
 	return sprintf(buf, "%u\n", (unsigned) v); \
 } \
-static DEVICE_ATTR(name, S_IRUGO, name ## _show, NULL);
+static DEVICE_ATTR(name, 0444, name ## _show, NULL);
 
 SHOW(aux1)
 SHOW(aux2)
-- 
2.17.1

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox