Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'auxdisplay-for-linus-v5.17-rc7' of git://github.com/ojeda/linux

Pull auxdisplay fixes from Miguel Ojeda:
"A few lcd2s fixes from Andy Shevchenko"

* tag 'auxdisplay-for-linus-v5.17-rc7' of git://github.com/ojeda/linux:
auxdisplay: lcd2s: Use proper API to free the instance of charlcd object
auxdisplay: lcd2s: Fix memory leak in ->remove()
auxdisplay: lcd2s: Fix lcd2s_redefine_char() feature

+10 -14
+10 -14
drivers/auxdisplay/lcd2s.c
··· 238 238 if (buf[1] > 7) 239 239 return 1; 240 240 241 - i = 0; 241 + i = 2; 242 242 shift = 0; 243 243 value = 0; 244 244 while (*esc && i < LCD2S_CHARACTER_SIZE + 2) { ··· 298 298 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)) 299 299 return -EIO; 300 300 301 + lcd2s = devm_kzalloc(&i2c->dev, sizeof(*lcd2s), GFP_KERNEL); 302 + if (!lcd2s) 303 + return -ENOMEM; 304 + 301 305 /* Test, if the display is responding */ 302 306 err = lcd2s_i2c_smbus_write_byte(i2c, LCD2S_CMD_DISPLAY_OFF); 303 307 if (err < 0) ··· 311 307 if (!lcd) 312 308 return -ENOMEM; 313 309 314 - lcd2s = kzalloc(sizeof(struct lcd2s_data), GFP_KERNEL); 315 - if (!lcd2s) { 316 - err = -ENOMEM; 317 - goto fail1; 318 - } 319 - 320 310 lcd->drvdata = lcd2s; 321 311 lcd2s->i2c = i2c; 322 312 lcd2s->charlcd = lcd; ··· 319 321 err = device_property_read_u32(&i2c->dev, "display-height-chars", 320 322 &lcd->height); 321 323 if (err) 322 - goto fail2; 324 + goto fail1; 323 325 324 326 err = device_property_read_u32(&i2c->dev, "display-width-chars", 325 327 &lcd->width); 326 328 if (err) 327 - goto fail2; 329 + goto fail1; 328 330 329 331 lcd->ops = &lcd2s_ops; 330 332 331 333 err = charlcd_register(lcd2s->charlcd); 332 334 if (err) 333 - goto fail2; 335 + goto fail1; 334 336 335 337 i2c_set_clientdata(i2c, lcd2s); 336 338 return 0; 337 339 338 - fail2: 339 - kfree(lcd2s); 340 340 fail1: 341 - kfree(lcd); 341 + charlcd_free(lcd2s->charlcd); 342 342 return err; 343 343 } 344 344 ··· 345 349 struct lcd2s_data *lcd2s = i2c_get_clientdata(i2c); 346 350 347 351 charlcd_unregister(lcd2s->charlcd); 348 - kfree(lcd2s->charlcd); 352 + charlcd_free(lcd2s->charlcd); 349 353 return 0; 350 354 } 351 355