gpio: Check for error from devm_mutex_init()
Subsystems (2)
v2 cover gpio: Check for error from devm_mutex_init()
Ignoring error checking from devm calls is a bad practice in general. While not critical today, it may become a problem tomorrow. Fix this for devm_mutex_init().
In v2:
- fixed obvious typo (Mary)
- collected tags (Mary, Wolfram)
Andy Shevchenko (2):
gpio: mpsse: Check for error code from devm_mutex_init() call
gpio: sloppy-logic-analyzer: Check for error code from
devm_mutex_init() call
drivers/gpio/gpio-mpsse.c | 9 +++++++-- drivers/gpio/gpio-sloppy-logic-analyzer.c | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
PATCH v2 1/2 gpio: mpsse: Check for error code from devm_mutex_init() call
Even if it's not critical, the avoidance of checking the error code from devm_mutex_init() call today diminishes the point of using devm variant of it. Tomorrow it may even leak something. Add the missed check.
--- drivers/gpio/gpio-mpsse.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpio/gpio-mpsse.c +7 -2
@@ -430,8 +430,13 @@ static int gpio_mpsse_probe(struct usb_interface *interface,if (err)return err; -devm_mutex_init (dev, &priv->io_mutex); -devm_mutex_init (dev, &priv->irq_mutex); + err =devm_mutex_init (dev, &priv->io_mutex); +if (err) +return err; + + err =devm_mutex_init (dev, &priv->irq_mutex); +if (err) +return err; priv->gpio.label = devm_kasprintf(dev, GFP_KERNEL, "gpio-mpsse.%d.%d",
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
PATCH v2 2/2 gpio: sloppy-logic-analyzer: Check for error code from devm_mutex_init() call
In reply to Andy ShevchenkoEven if it's not critical, the avoidance of checking the error code from devm_mutex_init() call today diminishes the point of using devm variant of it. Tomorrow it may even leak something. Add the missed check.
--- drivers/gpio/gpio-sloppy-logic-analyzer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-sloppy-logic-analyzer.c +3 -1
@@ -234,7 +234,9 @@ static int gpio_la_poll_probe(struct platform_device *pdev)if (!priv)return -ENOMEM ; -devm_mutex_init (dev, &priv->blob_lock); + ret =devm_mutex_init (dev, &priv->blob_lock); +if (ret) +return ret;fops_buf_size_set (priv,GPIO_LA_DEFAULT_BUF_SIZE );
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Bartosz Golaszewski
AppliedRe: (subset) [PATCH v2 0/2] gpio: Check for error from devm_mutex_init()
In reply to Andy ShevchenkoFrom: Bartosz Golaszewski <[email protected]>
Quoted 9 lines · Andy Shevchenko
Ignoring error checking from devm calls is a bad practice in general. While not critical today, it may become a problem tomorrow. Fix this for
devm_mutex_init().In v2:
- fixed obvious typo (Mary)
- collected tags (Mary, Wolfram)[...]
Applied, thanks!
[1/2] gpio: mpsse: Check for error code from devm_mutex_init() call
commit: 5e3eedf55f13ef20ff475eacac30d1e6f91641da
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>
Bartosz Golaszewski
AppliedRe: (subset) [PATCH v2 0/2] gpio: Check for error from devm_mutex_init()
In reply to Andy ShevchenkoFrom: Bartosz Golaszewski <[email protected]>
Quoted 9 lines · Andy Shevchenko
Ignoring error checking from devm calls is a bad practice in general. While not critical today, it may become a problem tomorrow. Fix this for
devm_mutex_init().In v2:
- fixed obvious typo (Mary)
- collected tags (Mary, Wolfram)[...]
Applied, thanks!
[2/2] gpio: sloppy-logic-analyzer: Check for error code from devm_mutex_init() call
commit: 90bad749858cf88d80af7c2b23f86db4f7ad61c2
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>